Flask Python framework

Flask is a Python framework. You can find more info at the official website.

https://flask.palletsprojects.com

How to start a Flask application?

To start flask application, run

Advertisement

python app.py

How to run flask application on port 80

To run flask application on port 80, use command

flask run --host 0.0.0.0 --port 80

Or edit app.py, use the following code

if __name__ == '__main__':
    app.run(host='0.0.0.0', port=80)

Or you can use the following environment variables

FLASK_RUN_HOST=0.0.0.0
FLASK_RUN_PORT=80

Port 80 can only be used by the root user, so you need to run the above command as root. Only do this for testing as it is insecure to run an application as the root user.

Default flask app name

When you run

flash run

It looks for app.py file. If you need to change the file name, you can use the environment variable

FLASK_APP=application.py
Add a comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Advertisement