python django:为每个django项目创建一个新的virtualenv吗? [英] python django: create a new virtualenv for each django project?
问题描述
每次启动新项目时,是否创建新的 virtualenv
?
Do you create a new virtualenv
every time you start a new project?
我正在浏览网络上的一些教程,他们首先创建了virtualenv,然后在 virtualenv
中创建了 pip install django
.但是我看到有一个教程说您不会在virtualenv内创建一个项目,它仅用于依赖项.
I'm going through some tutorials on the web and they create a virtualenv first then pip install django
in the virtualenv
. But there's one tutorial that i saw saying that you wouldn't create a project within the virtualenv and its only used for dependencies.
推荐答案
我个人这样做.
Virtualenvs帮助您保持项目的必需依赖关系的组织性和可管理性.如果您有django 1.7项目,它将需要django1.7,然后将其安装在您的virtualenv中.如果没有virtualenv,您可能会决定进行一个需要django1.10的项目.这意味着您的django1.7项目可能会中断.为了避免这种情况,请使用虚拟环境.
Virtualenvs help you keep the dependencies required for a project organised and manageable. If you have a django 1.7 project, it will require django1.7 and thus install it in your virtualenv. Without a virtualenv, you might decide to take on a project that requires django1.10. This means your django1.7 project might break. To avoid such a scenario use a virtual environment.
这篇关于python django:为每个django项目创建一个新的virtualenv吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!