简体   繁体   English

适用于Django开发人员的Virtualenv,最好是在项目或应用程序级别?

[英]Virtualenv for Django dev, better to be at Project or App level?

With Django, Is it better to have a virtualenv created at project level. 使用Django,在项目级别创建virtualenv更好吗?

Or, 要么,

is it better to have a virtualenv per app within a single project? 在单个项目中每个应用都有一个virtualenv更好?

All the apps installed (INSTALLED_APPS) within a single project run under the same python process, so it's going to be one virtualenv for all apps. 一个项目中安装的所有应用程序(INSTALLED_APPS)都在同一python进程下运行,因此它将成为所有应用程序的一个virtualenv。

If you have an app that requires a specific python environment and the others really aren't able to run in that environment (for example, if one app requires python3 and another requires python2), then you would have to run the problem app in its own Django application server instance. 如果您有一个需要特定python环境的应用程序,而其他应用程序确实无法在该环境中运行(例如,如果一个应用程序需要python3,而另一个应用程序则需要python2),则必须在该应用程序中运行有问题的应用程序自己的Django应用服务器实例。

Since normally you would have nginx or Apache in front of your Django instance, you could have multiple Django instances appear to be one server. 由于通常在Django实例的前面有nginx或Apache,因此您可能有多个Django实例似乎是一台服务器。 But it's a situation you'd want to avoid. 但这是您要避免的情况。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM