Let me start by saying, that I don't think there is a way to do this... but, there are a lot of clever people out there and so I thought I would ask! :)
I found a good article/post by Randall Degges on setting up a Django app on Heroku (Internet Archive link). I really like what he has to say about breaking your requirements up into different files (common.txt, dev.txt, prod.txt etc).
This works great on Heroku for production, but I also maintain a Dev/QA site on Heroku, and I have a few packages that I don't really need for prod that I do use for Dev/QA. The best example is django-debug-toolbar. Currently, I do have this in my production requirements.txt, and I dynamically decide if I need to add it to my installed apps, etc in settings.py at runtime by looking at the DEBUG setting.
Which works fine... but, it would be great if I could not even bother about installing it in prod. I guess what I sort of want is for pip to be able to take a requirements file that allows for conditionals includes (why couldn't it just take a python file?) or for Heroku to support a config setting that tells it which requirements file to use. Has anyone found a way of accomplishing this? Or is it just wishful thinking?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…