❓
Dev Info
  • Welcome
  • Python
    • Install
    • Virtual Environments
    • Challenges
    • Flask
      • Docs
      • Examples
      • Tutorials
    • FastAPI
      • Docs
    • Docs
    • FAQ
  • CSS
    • Challenges
  • HTML
    • Challenges
  • JAVASCRIPT
    • Challenges
  • REACT
    • Challenges
  • Redis
    • Install
    • Docs
  • Books
    • Testing
  • GIT
    • SSH
Powered by GitBook
On this page
  • Example Template Repo
  • Simple Example From Flask Docs:
  • Better Simple Example:

Was this helpful?

  1. Python
  2. Flask

Examples

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

PreviousDocsNextTutorials

Last updated 4 years ago

Was this helpful?

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.

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 afterward. I got the idea for this better example from .

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.

Want to know what __name__ means?

from flask import Flask

app = Flask(__name__)


@app.route('/')
def hello_world():
    return 'Hello World!'


if __name__ == "__main__":
    app.run(debug=True)

Better Simple Example:

Coming soon...

The Flask Mega Tutorial
Learn more
Learn more
Better Simple Example
Learn more