Getting Started with Flask

A short introduction to Flask for beginners.

This page aims to help beginners getting started with Flask, a popular Python web framework. For newcomers, Flask is a lightweight web application framework designed to make getting started quick and easy, with the ability to scale up to complex applications.

How to getting started with Flask

The quickest setup is to install Python3, a code editor like VsCode or Atom, and (optionally) GIT the popular command-line versioning tool.

Once all tools are installed and accessible in the terminal, we can code and start a simple Flask application:

Step #1 - Install Flask using PIP

$ pip install Flask

Step 2 - Create a new file app.py with following content:

from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello from Flask!'
if __name__ == '__main__':
app.run()

Step #3 - Start the app

$ python3 app.py

By visiting the http://127.0.0.1:5000/ in the browser, we should see the Hello World message served by Flask.

Resources