Application hosting
Deploy Flask with Phusion Passenger
Deploy a Flask application on HostRight with HostRight Control Panel, Passenger, SSH, environment variables, static files, and a production WSGI entry point.
Flask on HostRight
Flask is a good fit for small websites, APIs, internal tools, and focused services. HostRight runs Flask through a WSGI callable managed by Phusion Passenger.
Start with the Python deployment guide for the shared HostRight Control Panel, Git, SSH, SFTP, and FTP workflow.
Prepare a private project
Use a directory outside public_html:
apps/example-flask/
├── app.py
├── passenger_wsgi.py
├── requirements.txt
├── templates/
└── static/
Example app.py:
from flask import Flask
app = Flask(__name__)
@app.get("/healthz")
def healthz():
return {"status": "ok"}
Transfer and create the application
Clone the repository over SSH:
mkdir -p ~/apps
cd ~/apps
git clone git@github.com:example/example-flask.git example-flask
SFTP and FTP are also supported. Use SFTP for encrypted transfer and FTP only when required.
In HostRight Control Panel, open Extra Features → Setup Python App → Create Application:
Application root: apps/example-flask
Application startup file: passenger_wsgi.py
Application entry point: application

Add the WSGI entry point
Create passenger_wsgi.py:
from app import app as application
Passenger imports application. The alias is important when the Flask object in app.py is named app.
Add database, Redis, and SSL
Create the database and user under Account Manager → Databases. Put the exact host, name, username, password, and port from the Control Panel into environment variables. See Create and manage a database.
Enable Redis under Advanced Features → Redis, copy the account-specific Unix socket path, and configure a separate Redis database ID for this application. Use Redis for cache or sessions, not permanent storage. See Enable and use Redis.
After the domain points to HostRight, request a certificate under Account Manager → SSL Certificates. Test the application over HTTPS and set secure cookies and HTTPS-aware redirects in the Flask configuration. See the SSL setup instructions.
Install dependencies
cd ~/apps/example-flask
source ~/virtualenvs/example-flask/bin/activate
python -m pip install -r requirements.txt
python -c "import passenger_wsgi; print(passenger_wsgi.application)"
Do not use flask run or python app.py as the production process. Passenger starts the WSGI application for the configured domain.
Configure and update
Add variables such as:
FLASK_ENV=production
SECRET_KEY=replace-with-a-random-secret
DATABASE_URL=replace-with-your-database-connection
Use a migration tool such as Flask-Migrate when the project has a database. Keep uploaded files outside a Git release when they must survive deployments.
For an update:
cd ~/apps/example-flask
git pull --ff-only origin main
source ~/virtualenvs/example-flask/bin/activate
python -m pip install -r requirements.txt
Reload the application in HostRight Control Panel and test /healthz, login, forms, database queries, email, uploads, and static files.