The method for running an application with a development server is explained on the following page. Note that it should not be used in a production environment. (Flask Documentation on Development Server)
There are two ways to run hello.py
on a development server:
-
Using the
flask run
command:$ flask --app hello run
-
Including the following run method in the code:
if __name__ == "__main__": app.run(debug=True)
To run the application:
$ python hello.py
The method for deploying to a production environment is explained on the following page (Flask Documentation on Deployment)
In a production environment, a WSGI server should be used. There are also methods to use it in combination with an HTTP server such as Apache (Reverse Proxy).
Examples of WSGI servers (refer to the above page for details)
- Gunicorn
- Waitress
- mod_wsgi
- uWSGI
Instructions on configuring a reverse proxy with Apache Server are explained on the following page (Flask Documentation on Apache HTTPD Deployment)
For more detailed information, refer to Apache’s documentation or wiki