[Python] How can I customize a requirements.txt file for multiple environments?

Discussão em 'Python' iniciado por Stack, Novembro 22, 2025.

  1. Stack

    Stack Membro Participativo

    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)

    Continue reading...

Compartilhe esta Página