...

/

Python Flask Servers

Python Flask Servers

Learn how to create 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.
Access this course and 1400+ top-rated courses and projects.