How can I customize a requirements.txt file for multiple environments?
03:53 23 Jul 2013

I have two branches, Development and Production. Each has dependencies, some of which are different. Development points to dependencies that are themselves in development. Likewise for Production. I need to deploy to Heroku which expects each branch's dependencies in a single file called 'requirements.txt'.

What is the best way to organize it?

I've thought of:

  • Maintain separate requirements files, one in each branch (must survive frequent merges!)
  • Tell Heroku which requirements file I want to use (environment variable?)
  • Write deploy scripts (create a temporary branch, modify the requirements file, commit, deploy, and delete the temporary branch)
python deployment heroku requirements.txt