Flask Quickstart


Flask is a Python microframework for building web sites with minimal overhead. Think of it as a lightweight version of Django with fewer features, but better speed. Flask is supported on v6+ platforms using Passenger.


All steps are done from the terminal. While it may be possible to deploy a Flask application without using terminal, it is strongly recommended for ease.

  1. Prerequisite: create a Passenger-compatible filesystem layout
  2. Change directories to the base, we’ll name the base directory flask in /var/www
    • cd /var/www/flask
  3. Optional: determine which Python version to use for Flask using pyenv
  4. Install flask using pip:
    • pip install flask
  5. Create a Passenger startup file to run Flask as a Python WSGI application:
    • from flask import Flask
      application = Flask(__name__)
      def hello():
       return "Hello World!"
      if __name__ == "__main__":
    • Of importance, this example is identical to the Flask “Hello World!” example with a minor change: app is renamed to application to comply with Passenger. Passenger will always look for an instance variable named application to run the application.
  6. Connect public/ to a subdomain within the control panel under Web > Subdomains
  7. Access your subdomain running Flask

Restarting a Flask app

Since Flask runs using Passenger, it uses the same restart method as any Passenger-backed app.

See also


Leave a Reply