Django | update requirements.txt automatically after installing new package

Viewed 2864

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
2 Answers

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

You need to write the script for that and set a cron job which will perform this action.

Not the same thing but a better one, you can have a look on, pipreqs

Related