BigCloudy KnowledgeBase BigCloudy KnowledgeBase
  • Cloud Hosting
    • cPanel Hosting
    • Laravel Hosting
    • Node.js Hosting
    • Magento Hosting
    • Django Hosting
    • Reseller/Agency Hosting
    • SSL Certificates
  • WordPress
    • WordPress Hosting
    • WooCommerce Hosting
  • VPS & Dedicated Server
    • Linux VPS Hosting
    • Windows VPS
    • Forex VPS Hosting
    • SEO VPS Hosting
    • n8n VPS Hosting
    • Dedicated Servers
  • AI Website Builder
Log in
BigCloudy KnowledgeBase BigCloudy KnowledgeBase
Log in
BigCloudy KnowledgeBase BigCloudy KnowledgeBase
  • Cloud Hosting
    • cPanel Hosting
    • Laravel Hosting
    • Node.js Hosting
    • Magento Hosting
    • Django Hosting
    • Reseller/Agency Hosting
    • SSL Certificates
  • WordPress
    • WordPress Hosting
    • WooCommerce Hosting
  • VPS & Dedicated Server
    • Linux VPS Hosting
    • Windows VPS
    • Forex VPS Hosting
    • SEO VPS Hosting
    • n8n VPS Hosting
    • Dedicated Servers
  • AI Website Builder
creativeleaf
loading
Popular Searches
  • wordpress
  • how do i add new domains or subdomains in plesk?
  1. Home
  2. Framework
  3. Python
  4. How Do I Manage Static and Media Files in Django Hosting?
Updated on February 9, 2026
Framework
  • Folder icon closed Folder open iconNode.Js
    • How do I deploy a Node.js app on your hosting?
    • What Node.js Versions Are Supported?
    • How Do I Configure Environment Variables in Shared Hosting?
    • Can I Run Multiple Node.js Apps Under One Account?
    • How to fix “503 Service Unavailable” in Node.js hosting?
  • Folder icon closed Folder open iconPython
    • Do You Support Python and Django Applications?
    • How Do I Deploy a Django App on Your VPS or Shared Server?
    • How to set up Gunicorn and Nginx for Django?
    • How Do I Manage Static and Media Files in Django Hosting?
    • Can I use virtual environments with Django hosting?
  • Folder icon closed Folder open iconLaravel
    • How to Deploy a Laravel Project on BigCloudy Shared Hosting ?
    • How Do I Set Up .env and Manage Environment Variables in Laravel?
    • Is SSH access available for running artisan commands?
    • How to configure queues and cron jobs in Laravel hosting?
    • Can I connect Laravel with a remote MySQL server?

How Do I Manage Static and Media Files in Django Hosting?

Introduction

When hosting a Django application on shared Django hosting, properly managing static and media files is essential. Static files include CSS, JavaScript, and images used by your app, while media files are user-uploaded files like profile pictures or documents.

In a shared hosting environment powered by CloudLinux Passenger, you can handle both without needing root access just using cPanel, your terminal, and a few Django settings.

By the end of this guide, you’ll know how to configure your static and media directories, run collectstatic, and ensure your files load correctly from your domain.

Understanding Static and Media Files in Django

Static Files

These are the files used to style and enhance your website, such as:

  • CSS and JavaScript files
  • Fonts
  • Site images (e.g., logos, icons)

Django uses the STATIC_URL and STATIC_ROOT settings to define where these files are stored and how they’re accessed.

Media Files

Media files are uploaded by users and stored separately.
These include:

  • Uploaded images (avatars, product photos)
  • Documents or attachments

They’re configured through MEDIA_URL and MEDIA_ROOT.

 Note: Always separate static and media files to avoid overwriting or exposure of sensitive content.

Default Django Settings for Static and Media Files

In your Django project’s settings.py, add or update the following:

				
					import os 
STATIC_URL = '/static/' 
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') 
MEDIA_URL = '/media/' 
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
				
			

Note:

 Never place your media directory inside your static directory. Passenger will serve static files automatically if correctly configured in cPanel.

Step-by-Step: Configure Static and Media Files in cPanel

  1. Log in to your cPanel account.

    Navigate to your domain’s cPanel dashboard.
cPanel login page

2. Locate your Django app directory.

Go to the folder where your Django project resides (e.g., /home/username/projectname/).

3. Create static and media folders.
Inside your project directory, create two folders:

  • /staticfiles/
  • /media/
  • Update Passenger settings.
    In your cPanel Setup Python App section, confirm your application root points to your Django project folder and that the passenger_wsgi.py file exists.
  1.  

5.Save and restart the app.
Click Restart App to reload the Passenger environment.

3. This gathers all static files into your STATIC_ROOT folder.

4. Verify file creation.
Use File Manager to confirm that your static files are stored under /staticfiles/.

Note: Run collectstatic after every change in your CSS or JS files to ensure updates are visible.

Serving Static Files with CloudLinux Passenger

Passenger automatically serves static content if it’s in your app directory.

To confirm this:

  1. Check your .htaccess file under the project root.
  2. Add the following rule if missing:
				
					PassengerEnabled on

Alias /static /home/username/projectname/staticfiles

Alias /media /home/username/projectname/media
				
			
  1. Save changes and restart the app in cPanel.

Note: Some shared servers restrict manual .htaccess edits. If static files still don’t load, contact support to verify that Passenger is configured to serve them.

Managing Media Uploads via cPanel File Manager

You can manage user-uploaded files without SSH access.

  1. Go to Files → File Manager.
  2. Navigate to your app’s /media/ folder.
  3. Upload files directly or view user uploads.
  4. Ensure correct permissions (755) for directories and 644 for files.

Note: To prevent unauthorized access, avoid storing private user data in publicly accessible folders.

Common Issues and Fixes

Issue Cause Solution
Static files not loading collectstatic not run or wrong path Check STATIC_ROOT path and rerun collectstatic.
Media files inaccessible Permissions too strict Set proper read permissions (755/644).
404 error for static URLs Alias missing in .htaccess Add Passenger alias rules.
Changes not reflecting Browser cache or old files Clear cache and restart app.

Conclusion

Managing static and media files in Django on shared hosting follows a clear and predictable process. By defining proper paths in settings.py, keeping static and media directories separate, and running collectstatic after changes, files can be served reliably through CloudLinux Passenger without root access.

cPanel tools and optional SSH access provide enough control to upload files, verify permissions, and restart applications when needed. As long as directory paths, permissions, and Passenger settings are correct, static assets and user-uploaded media will load consistently in a shared hosting environment.

Need Help?

If you require assistance at any point while using this guide, our Support Team is here to help:

  • email Email: support@bigcloudy.com
  • website Submit a support ticket

FAQ

Do I need SSH to manage static files?

No. You can use cPanel File Manager to upload or replace static and media files, though SSH access makes collectstatic faster.

Why are my static files not updating?

Run:
# python manage.py collectstatic again after making changes, then restart your app.

Where are my uploaded media files stored?

They’re stored in your project’s /media/ directory as defined in MEDIA_ROOT.

Can I use a CDN for Django static files?

Yes. Configure STATIC_URL to point to your CDN endpoint once files are synced.

How can I check which static directory Django is using?

Run:
# python manage.py findstatic <filename>

Still stuck? How can we help?

How can we help?

Was this page helpful? Yes No

Powered By BigCloudy

Cloud Hosting

cPanel Hosting
Laravel Hosting
Node.js Hosting
Magento Hosting
Django Hosting
WordPress Hosting
WooCommerce Hosting
Reseller / Agency Hosting

Cloud VPS & Server

Linux VPS Hosting
Windows VPS Hosting
Forex VPS Hosting
SEO VPS Hosting
n8n VPS Hosting
Dedicated Server

Addons

Domain
SSL Certificates
AI Website Builder
Affiliate Program

Company

About Us
Contact Us
Blog
Knowledge Base
Sitemap
Status

Legal

Privacy Policy
Terms of Service
Refund Policy
Affiliate TOS

Follow Us

Facebook X-twitter Instagram Linkedin

Copyright Ⓒ 2026 BigCloudy Internt Services Pvt. Ltd. All Rights Reserved