Python Flask Servers

Introduction to Flask

Flask provides its own development server to allow you to develop it and get quick feedback. We’ll develop a single-file application to show how to create a Flask app.

Here’s a minimal web server to get us started. We’ll save it as flask_app.py.

Routing with the help of Python decorators

Let’s extend the Flask example so that one function responds to two different routes and another responds to one. In general, routes should not end with a slash, except for the root route('/').

Try it yourself


Note: We have already run the following commands in the terminal to get the virtual environment running in the widget below:
pipenv shell
export FLASK_APP=flask_app.py
export FLASK_ENV=development


  1. You will have to click the “Run” button and execute the following command.

Get hands-on with 1400+ tech skills courses.