Skip to main content
Flask is the smallest viable WSGI app. One file imports your app object and aliases it as application. 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 Flask code (e.g. app.py defining app = Flask(__name__)).
  • A requirements.txt listing Flask and your other packages.

Wire up Passenger

1

Create passenger_wsgi.py

passenger_wsgi.py
from app import app as application
If your Flask app object is named differently (e.g. flask_app = Flask(__name__)), alias it: from app import flask_app as application.
2

Install dependencies

Click Run Pip Install in the cPanel app management page.
3

Restart

Click Restart.

Strip the dev server

Most Flask tutorials end with:
if __name__ == '__main__':
    app.run(debug=True)
Leave the if __name__ block, or remove it. It’s never executed under Passenger anyway. Just don’t call app.run() at module top level.

Common issues

passenger_wsgi.py doesn’t expose application. Check the import line: from app import app as application.
Pip ran against the system Python, not the per-app virtualenv. Install via the cPanel Run Pip Install button, or activate the env first in SSH.
Passenger caches the loaded modules. Restart with the Restart button or touch tmp/restart.txt.

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.