Matt Stokes
Matt Stokes

Reputation: 4958

Django requirements.txt FIle in root

I have set-up a requirements folder as such:

requirements/
  local.txt
  development.txt/
  production.txt/

I am wondering what I put in my base requirements.txt file to redirect to the appropriate file? I don't want to have to use the -r requirements/local.txt. I want a solution based off my virtual environment.

Is there a similar variable to DJANGO_SETTINGS_MODULE except for requirements instead of settings?

Upvotes: 4

Views: 1315

Answers (2)

Leonardo.Z
Leonardo.Z

Reputation: 9801

There's no built-in environment variable pip will use to locate the requirements.txt. But you can define your own.

e.g

export PIP_REQUIREMENTS_TXT=requirements/development.txt

pip install -r $PIP_REQUIREMENTS_TXT

Upvotes: 0

dm03514
dm03514

Reputation: 55972

generally there is a some sort of common.txt requirments file which would hold the shared packages, like django and you could extend that in your development.txt with a line that says

-r requirements/common.txt
pygraphviz
django-nose

etc..

The above imitates a sort of inheritance, and is a common and elegant (i believe) way to handle multiple requirments

I am pretty sure there is not a solution that allows you to set an environmental variable that points to a requirements file, and have the webserver automaticaly bootstrap your environment with the packages listed in the file; although that would be pretty cool if there were!

Upvotes: 7

Related Questions