passenger_wsgi.py shim. Static files are served by Apache, not Django.
For the underlying tool, see Python.
Before you begin
- A Python app created in cPanel, version 3.10 or 3.11.
- The app root contains your Django project (
manage.py,<projectname>/settings.py). - A
requirements.txtlisting Django and your other packages.
Wire up Passenger
Create passenger_wsgi.py in the app root
passenger_wsgi.py
<user> and myapp with your real cPanel user and project name.Install dependencies
Click Run Pip Install in the cPanel app management page. Make sure
requirements.txt is listed under Configuration files.Serve static files
Django doesn’t serve/static/ in production. Have Apache do it. Add to the app root’s .htaccess above the Selector-managed block:
STATIC_ROOT = BASE_DIR / 'staticfiles' in settings.py so collectstatic writes there.
Common issues
500 after the first request, log shows ImproperlyConfigured
500 after the first request, log shows ImproperlyConfigured
DJANGO_SETTINGS_MODULE doesn’t match your project layout. Open passenger_wsgi.py and confirm the module path. Then touch tmp/restart.txt.`pip install` fails with a memory error on a heavy package
`pip install` fails with a memory error on a heavy package
Common with
numpy, pandas, Pillow. Install one at a time over SSH, or pre-build wheels on a dev machine.ALLOWED_HOSTS error
ALLOWED_HOSTS error
Add your domain to
ALLOWED_HOSTS in settings.py. Restart.Need a hand?
Open a ticket
Best for anything that needs an account check or a config change on our end.
Live chat
Faster for quick questions during business hours.

