virtualenvwrapper中的环境和项目之间有什么关系? [英] What's the relationship between environments and projects in virtualenvwrapper?
问题描述
换句话说,mkvirtualenv
和mkproject
命令之间有什么区别?
In other words, what's the difference between the mkvirtualenv
and mkproject
commands?
我的工作流程如下:
/dev
projectA
appA
appB
projectB
appA
appB
所有应用程序共享一些资源(例如South,pep8等),但是其他资源特定于每个应用程序.我应该使用virtualenvwrapper项目"来使这些依赖项分开吗?
All of the apps share some resources (like South, pep8, etc.), but other resources are specific to each app. Should I be using virtualenvwrapper "projects" to keep these dependencies separated?
推荐答案
From my understanding of the documentation, mkvirtualenv projectenv
simply creates a new virtual environment named projectenv
in $WORKON_HOME
, while mkproject projectenv
creates a new virtual environment named projectenv
and a new directory named projectenv
; after creation, the projectenv
directory automatically becomes your current working directory. The virtual environment will exist in $WORKON_HOME
and the development directory exists in $PROJECT_HOME
.
注意,要使mkproject
正常工作,必须首先将环境变量PROJECT_HOME
设置为要在其中创建项目的目录的名称.您可以在设置$WORKON_HOME
变量或即时设置它的位置进行操作,例如
Note, formkproject
to work correctly, you must first set the environment variable PROJECT_HOME
to the name of the directory where you would like projects to be created. You can do this in the same place you set your $WORKON_HOME
variable or set it up on the fly, e.g.
export PROJECT_HOME=$HOME/src/allprojects
mkproject mynewproject
mynewproject
现在将是您当前的虚拟环境,并且~/src/allprojects
中将存在一个新的mynewproject
目录.
mynewproject
will now be your current virtual environment and a new mynewproject
directory will exist in ~/src/allprojects
.
这篇关于virtualenvwrapper中的环境和项目之间有什么关系?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!