What is Flask Python? A short Flask framework tutorial

Flask Python is a slim web framework, suitable for beginners and professionals alike. Flask is limited to including only the essentials, but users can implement external libraries to expand its functionality.

The fast way to your own website

Build an engaging website in minutes with MyWebsite Now.

Image library

Python and its web frameworks

Python is a popular internet programming language favoring the use of simple and short code. The neat programming style minimizes errors and users can quickly get their heads around a Python tutorial. Developed by Guido van Rossum in 1991, it’s now used and maintained by a large community under the supervision of the non-profit Python Software Foundation. Python is open source and platform independent. Python is a dynamic language. It supports object-oriented and functional programming such as logging and can be executed as CGI script.

Various web frameworks are available to use Python to create dynamic websites and develop web applications. These provide the necessary code to ease the development process and simplify repeat tasks. Issues or common Python errors can be avoided and web services are up and running faster and in a more secure manner. Frequently required functions can be adopted directly and don’t require independent programming. One of the best-known web frameworks for Python is Django CMS, which is a full-stack solution providing a large toolbox of different functions. However, due to its size it’s also comparatively rigid. One of the best-known counter frameworks is Flask.


Want a fully personalized website? With MyWebsite from IONOS you can create a unique web presence in just three simple steps. No prior knowledge is required to create a professional website.

What is Flask?

While full-stack frameworks such as Django provide developers with their own libraries, Flask Python takes a different approach. The web framework launched by Austrian developer Armin Ronacher in 2010, takes a more minimalist approach. Flask only includes the template engine Jinja and a library called “tool”. But it offers the possibility to integrate third-party functions. The Flask framework is under a BSD license. It’s free and open source. As a counter-design to Django and other frameworks, Flask Python was quick to inspire a large fan community.


The fastest route to your own website! MyWebsite Now from IONOS is the ideal solution to develop a fully functional and well-designed website.

Python Flask tutorial to set up Flask and web applications

Before setting up Flask for Python, make sure you meet the requirements. You’ll need Python 2 or 3 installed. You will also need a text editor or IDE and access to the internet. Having some basic knowledge of Python is useful. An understanding of programming, data types, and for-loops is also advantageous. Flask is a good starting point to learn how to build web applications. You set up the framework as follows:

  1. Create a virtual environment to separate the new project from the rest of your Python libraries or projects and avoid problems with your system. The code looks like this:
$ python -m venv newproject
  1. Install Flask. The best way to do this is to use the package management program pip. The appropriate command is:
$ pip install flask
  1. Check if the installation has been successful:
$ python -c "import flask; print ( flask._version_ )"
  1. Now you can test Flask and create a basic application. To do this, open a file in your directory. Here, we call it start.py and use nano to access it:
$ nano start.py
  1. Write the following code into the file:
from flask import Flask
app = Flask ( _name_ )
@app.route ( "/" )
def test ( ):
return "This is a test"
  1. Save and close the file.
  2. Use the environment variable FLASK_APP to point Flask to the location of the corresponding file:
$ export FLASK_APP=start
  1. Use FLASK_ENV to export the file in developer mode:
$ export FLASK_ENV=development
  1. Now run the application:
$ flask run

The output should look something like this:

* Serving Flask app "start" (lazy loading)
* Environment: development
* Debug mode: on
* Running on [IP address]/ (Press CTRL+C to quit)
* Restarting with stat
* Debugger is active!
* Debugger PIN [PIN]

Pros and cons of Flask Python

There are good reasons for using Flask. However, a few things speak against it. For this reason, it’s worth taking a closer look at the pros and cons of the web framework.


  • Scope: You will hardly find a more streamlined framework than Flask Python. Flask is quick to install and use.
  • Flexibility: Flask offers outstanding flexibility. You can solve problems and implement the libraries you need, approaching each project individually.
  • Learning curve: Flask is quick to learn using a Flask tutorial. The framework is deliberately simple, but can equally be used for challenging projects. Flask is a great choice for beginners and professionals alike.
  • Open source: The Flask framework is open source and available for free. Simply give it a try and find out if it’s the right tool for your needs.
  • Community: Flask is supported by a huge community providing advice and support to newcomers and more experienced developers. Questions and errors are rapidly answered and solved.


  • Scope: Depending on intended use, its minimalist scope can be disadvantageous. All tools require individual installation. Alternative frameworks offer significantly more pre-installed functions.
  • Dependency on third-party providers: The use of external libraries is always a possible source of errors, but Flask depends on them.
  • Maintenance: While other frameworks are automatically maintained, Flask shifts that responsibility to the user. This means more control, but it also creates more work.

Practical and secure web hosting from IONOS offers flexible scalability, SSL certificate, lots of storage and many useful features. Select the right plan for your needs!

Conclusion ⁠— who should use Flask?

Flask isn’t just a great way to get to know how to work with web frameworks but is suitable for more demanding projects. The micro-framework comes in handy for those in need of more flexibility. Whether Flask Python is the right choice depends on your needs and the nature of your project. Check out our comparison of Flask vs Django in our Digital Guide.


From the latest web design trends, the basics of modern web development or useful CSS tricks, the IONOS Digital Guide has all the information you need. Explore web scraping with Python or check out our comparison of PHP vs Python.

We use cookies on our website to provide you with the best possible user experience. By continuing to use our website or services, you agree to their use. More Information.
Page top