Skip to content
Advertisement

Separating development and production dependencies with virtualenv

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?

Advertisement

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.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement