Creating a Python application
- Log in to cPanel.
- In the Software section, click Setup Python App.
- Click Create Application and complete the form:
- Python version: choose the version your app needs.
- Application root: folder for the app (e.g. pyapp), relative to your home directory.
- Application URL: domain or subdomain/path where the app is served.
- Application startup file: typically passenger_wsgi.py (created automatically).
- Application Entry point: the WSGI callable, typically application.
- Click Create.
A minimal Flask example
Activate the app’s virtual environment over SSH (the activation command is displayed at the top of the app’s page in cPanel), then:Installing dependencies
With the virtual environment activated over SSH:Django notes
Django works well under this setup:- Point passenger_wsgi.py at your project’s WSGI module:
- Run management commands (migrations, collectstatic) over SSH inside the virtual environment.
- Serve static files from a folder mapped under your document root, or via WhiteNoise.
Troubleshooting
- Check stderr.log in the application root for startup errors.
- After code changes, always Restart the application.
- Import errors usually mean dependencies were installed outside the app’s virtual environment — activate the right environment and reinstall.