Django virtualenv布局 [英] Django virtualenv layout
问题描述
不,创建虚拟环境的目录是完全独立的你不会去创建你的django项目。
事实上,你通常会把你所有的虚拟环境放在一个单独的目录中;对我来说,我把它们放在 $ HOME / work / .envs
(注意。
默认),所以我的工作流程变成:
$ virtualenv $ HOME / work / .envs / new_env
$ source $ HOME / work / .envs / new_env / bin / activate
(new_env)$ pip install django
(new_env)$ cd〜/ projects
(new_env)/ projects $ django-admin。 py startproject atestproj
所以你看,你实际上没有对虚拟环境目录做任何事情;它完全由 virtualenv
和 pip
管理。
virtualenvwrapper
项目通过管理您的虚拟环境使您更轻松一个中央位置。
I am very new to django. I just have a very basic question about project layout using virtualenv. When we create virtualenv and install all the dependencies-django etc, do I need to switch my directory to the virtualenv and then create a project there? Or do I need to create my project outside of virtualenv. I apologize if it is a very basic question.
No, the directory where you create the virtual environment is completely separate and is not where you would go and create your django project.
In fact, you would usually put all your virtual environments in a separate directory; for me I put them in $HOME/work/.envs
(note the .
, this makes the directory hidden by default), so then my workflow becomes:
$ virtualenv $HOME/work/.envs/new_env
$ source $HOME/work/.envs/new_env/bin/activate
(new_env)$ pip install django
(new_env)$ cd ~/projects
(new_env)/projects$ django-admin.py startproject atestproj
So you see, you don't actually do anything with the virtual environment directory; it is completely managed by virtualenv
and pip
.
The virtualenvwrapper
project makes this easier by managing your virtual environments in a central location.
这篇关于Django virtualenv布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!