Conditional pip install requirements on Heroku for Django app

前端 未结 3 1107
深忆病人
深忆病人 2020-12-10 18:00

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

3条回答
  •  星月不相逢
    2020-12-10 18:41

    Yes, it's wishful thinking. The pip requirements file is very simple. Literally, all pip does is just prepend pip install to each line in the file, so conditionals and such are a no-go. Having separate requirement files for each environment is a nice idea, but the question becomes why not just have a version for your Dev/QA site as well?

    That said, I think this is all a bit academic anyways. Simply having a package installed doesn't hurt anything. For instance, it doesn't matter if you have the django-debug-toolbar package installed even in production, your production instance won't actually use it, so aside from the few kilobytes of drive space it takes up, it's not a problem.

    Personally, I always just have one requirements file, and in there, I only put requirements, i.e. these are packages that the site literally cannot run without. Things like django-debug-toolbar, ipython, etc. I just install manually when I need them.

提交回复
热议问题