Flask Tutorial for Beginners (How to use Flask to Create Web Apps)

Python flask create web appsPin

Create and use requirements.txt file to install flask modules used in that project

How to create a requirements.txt file?

Open Terminal and type the following command.

pip freeze

you will get something like this

async-generator==1.10
attrs==22.2.0
beautifulsoup4==4.11.2
blis==0.7.9
catalogue==2.0.8
certifi==2022.12.7

Now use the following command.

pip freeze > requirements.txt

This command creates a text file named requirements.txt with system-installed flask module names.

So always use Python virtual environment to install modules and run the Python application.

How to install flask modules with requirements.txt

First, create “requirements.txt” file in your Flask application folder.

Add required module names one by one like this

Flask
bcrypt
email-validator
Flask-WTF

Now run the following command to install the modules.

pip install -r requirements.txt

That's all.

SEE ALSO: Flask-SQLAlchemy: DB Connection & Create table in MySQL

About The Author

Scroll to Top
Share to...