Install Flask on Ubuntu 20.04 - Step by Step process to implement it ?

This article covers how to install Flask on Ubuntu 20.04. Flask is a powerful web framework for any developer. Unlike Django , by default Flask doesn’t include ORM, form validation, or any other functionalities provided by third-party libraries. Flask is built with extensions in mind, which are Python packages that add functionality to a Flask application.

Flask packages are included in the official Ubuntu repositories and can be installed using the apt package manager. 

This is the simplest way to install Flask on Ubuntu 20.04, but not as flexible as installing in a virtual environment. 

Also, the version included in the repositories may lag behind the latest version of Flask.

To install Flask on Ubuntu 20.04:

1. Ubuntu 20.04 ships with Python 3.8. You can verify that Python is installed on your system by typing:

$ python3 -V

2. The recommended way to create a virtual environment is by using the venv module, which is provided by the python3-venv package. Run the following command to install the package:

$ sudo apt install python3-venv

3. Create a new directory for the Flask application and switch into it:

$ mkdir flask_app && cd flask_app

4. Run the following command inside the directory to create the virtual environment:

$ python3 -m venv venv

The command will create a directory called venv, which contains a copy of the Python binary, the Pip package manager , the standard Python library, and other supporting files. You can use any name you want for the virtual environment.

5. To start using the virtual environment, you need to activate it with the activate script:

source venv/bin/activate

6. Now that the virtual environment is activated, use the Python package manager pip to install Flask:

$ pip install Flask

7. To verify the installation, run the following command, which prints the Flask version:

$ python -m flask --version