A few examples on various things you will need to do with Flask.

Example Template Repo

Throughout this example page, I base a lot of the examples on the following repo. Please clone or download the example as a base starting point when I mention the use of that repo.

After downloading or cloning the repo you will want to set up your virtual environment and install all the packages via the requirements.txt file. Learn more

Simple Example From Flask Docs:

If you go to the Flask docs you will see a very simple example to quickly teach you the simple concepts and I have that listed below. I would recommend taking a look at the Better Simple Example afterward. I got the idea for this better example from The Flask Mega Tutorial.

Create a new file called app.py, paste the following code, and then inside your terminal run python app.py.

Don't forget to be inside your virtual environment. Learn more

Want to know what __name__ means? Learn more

from flask import Flask

app = Flask(__name__)

def hello_world():
    return 'Hello World!'

if __name__ == "__main__":

Better Simple Example:

Coming soon...

Last updated