How To Customize Pip's Requirements.txt In Heroku On Deployment?
Solution 1:
You can include a requirements file in another requirements file.
# requirements.txt
-r requirements/base.txt
# requirements/base.txt
django==1.6
# requirements/heroku.txt
-r requirements/base.txt
djpostgresurlthing==1.0.0
# requirements/dev.txt
-r requirements/base.txt
django-debug-toolbar
I typically keep a requirements.txt
file in the root of the project that just includes other requirements files(usually prod or a base) and make a requirements/
folder with environment specific stuff. So locally I'd pip install -r requirements/dev.txt
and on the server pip install -r requirements/prod.txt
.
For your case with heroku, you need the root requirements.txt to be for heroku. So you can just use that file to include your heroku requirements file.
# requirements.txt
-r requirements/heroku.txt
There's probably SOME way to tell heroku to use a different file. But this would be an easy way to get around it.
Solution 2:
You can do standard HTTPS auth:
# requirements.txt
git+https://user:password@example.com/dir/repo.git
But a much cleaner way would be to host your own set of requirements, see: https://devcenter.heroku.com/articles/python-pip#private-indexes
For managing different environment requirements, you can simply use requirements.txt
for production and requirements-dev.txt
for local development, or one of @yellottyellott's suggestions for including dependencies from other files.
Post a Comment for "How To Customize Pip's Requirements.txt In Heroku On Deployment?"