Managing the contents of a .txt requirements file for a Python virtual environment

So, I am creating a completely new Flask application from scratch. Like all good developers, my first step was to create a virtual environment.

The first thing I install in a virtual environment is Flask == 0.11.1.Flask installs the following dependencies:

  • press == 6.6
  • itsdangerous == 0.24
  • jinja2 == 2.8
  • MarkupSafe == 0.23
  • Werkzeug == 11/11/11
  • wheels == 0.24.0

Now I am creating requirements.txt so that each cloning repository has the same version of libraries. However, my dilemma is this:

  • I mention each of the Flask dependencies in requirements.txt along with version numbers OR
  • Flask requirements.txt , pip install requirements.txt, Flask , .
+4
3

. . requirements.txt, . , , , - Werkzeug>=0.11 , Werkzeug.

, . , .

+1

, virtualenv, .

  • virtualenv ($source path_to_virtualenv/bin/active)
  • . txt

    pip freeze > requirements.txt
    
  • , , ,

    pip install -r requirements.txt
    
+8

( )

pip freeze > requirements.txt

/, .

:

pip install -r requirements.txt
+3

Source: https://habr.com/ru/post/1654097/


All Articles