Separating development and production dependencies with virtualenv

Tags: ,



I have a simple flask app, where I use virtualenv for managing my dependencies. However, I would like to separate my dependencies. For testing I use Flask-Testing, but this is a dependency I wouldn’t want to include in my production environment.

How can separate my dependencies, so that I have separate dependencies for development and for production?

Answer

You can have multiple requirements.txt files for different environments. eg. requirements_dev.txt, requirements_prod.txt

These files would have different pinned (having versions as well) packages. They can be generated by manually pip installing packages and then piping the output of pip freeze to a file.



Source: stackoverflow