Python apps (Flask, Django, or plain WSGI) run on shared hosting through cPanel's Python Selector, called "Setup Python App." It creates an isolated virtual environment, generates a WSGI entry file, and wires up the passenger config that connects your app to the web server. You don't manage a separate process manager or reverse proxy yourself.
Create the application
Open cPanel from your hosting service (see Accessing cPanel if you need the way in). Find Setup Python App under Software, then:
- Click Create Application.
- Pick a Python version from the dropdown.
- Set the Application root, the folder your code lives in (for example
myapp, relative to your home directory). - Set the Application URL, the domain or subdomain the app should answer on.
- Set the Application startup file and Application Entry point. For Flask this is usually the file that defines your
appobject; for Django it's the file exposing theapplicationcallable, typicallywsgi.py.
Saving creates a dedicated virtual environment for the app and shows you the exact command to activate it over SSH, something like:
source /home/username/virtualenv/myapp/3.11/bin/activate && cd /home/username/myapp
The WSGI entry point
cPanel generates a passenger_wsgi.py file in your application root. This is the file the web server actually imports, it needs to expose a callable named application. For a minimal Flask app, that often means:
from myapp import app as application
For Django, point it at your project's own wsgi.py:
from myproject.wsgi import application
If your app object is named something other than application and you can't rename it, alias it in passenger_wsgi.py rather than fighting the framework's conventions. Setup Python App scaffolds a starter version of this file when you create the app, but it's a plain Python file, so you can edit it directly once your project structure is in place.
Installing requirements.txt
Get your code onto the server before installing dependencies, either through the portal file manager, an FTP/SFTP client, or by deploying with Git. Once the files are in the application root:
- Open Setup Python App and find your application in the list.
- Click the pencil/edit icon to open its detail page.
- Under the requirements section, point it at your
requirements.txtand run the install, or activate the virtual environment over SSH and run:
pip install -r requirements.txt
Always install into the virtualenv Setup Python App created for this app, not a system-wide Python. Each app gets its own environment, so dependency versions for one app never collide with another.
Static files
Flask and Django both serve static assets through the Python process by default in development, but that's not the efficient path in production. In production it's better to let the web server serve static files directly and reserve the Python app for dynamic requests. Setup Python App gives you a static files mapping field on the application's detail page: set the URL prefix (for example /static) and the local folder it should map to, and the server serves those files directly. For Django, run collectstatic into that folder first:
python manage.py collectstatic
Point the static mapping at whatever STATIC_ROOT resolves to, and Django's own static file handling is bypassed for those requests entirely.
Restarting after changes
Passenger-based apps don't reload automatically when you edit code. After any change to your application files or dependencies, go back to Setup Python App and click Restart on the app, or touch the tmp/restart.txt file in your application root if your setup uses that convention. If a working app suddenly starts throwing errors after a deploy, a stale process is the first thing to rule out.
If the app won't start
- Wrong entry point: confirm
passenger_wsgi.pyactually exposes something namedapplication, and that the import path matches your real file and object names. - Missing dependencies: make sure
requirements.txtwas installed into the same virtualenv the app is configured to use, not a different Python version. - Application root mismatch: the root must point at the folder containing
passenger_wsgi.py, not a parent or child directory. - Framework-level errors: check your app's own logging or the error log surfaced in cPanel. Most Flask and Django startup failures (bad imports, missing environment variables, unapplied migrations) show up there before you'd ever suspect the hosting layer.
If you've confirmed the entry point, dependencies, and application root are correct and the app still won't come up, open a ticket from Support in the portal. It's a real person looking at your specific setup, not a script.