Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django | update requirements.txt automatically after installing new package

I am new to Django.

Every time I install new library using pip, I have to run pip freeze -l > requirements.txt and sometimes I forget this ( and error happens at my production environment).

What's the best way to run this command automatically when I install new packages...?

I am using:

Django==1.11.5 
Python 3.6.1
like image 930
kansiho Avatar asked Sep 26 '17 23:09

kansiho


People also ask

Does requirements txt update automatically?

When using just plain pip to install packages, there is currently no way to make it automatically generate or update a requirements. txt file. It is still a manual process using pip freeze > requirements.

How do you install all packages in requirements txt in Django?

Use the pip install -r requirements. txt command to install all of the Python modules and packages listed in your requirements. txt file.

Does pip update requirements txt?

It will upgrade all the packages that are not at their latest versions, and also create an updated requirements. txt at the end.


1 Answers

For Python 3 use below to update requirements.txt file. ''' pip3 freeze > requirements.txt '''

like image 193
Anupam Chaplot Avatar answered Oct 18 '22 18:10

Anupam Chaplot