English 中文(简体)
建议的工作流程/最佳做法,以便在万不得已的情况下建立虚拟平台
原标题:Recommended workflow/best practice for setting up Virtual env within Vagrant

我正在追随从Django的辅导开始,并设法完成第1个项目,但当我重新进入Vagrant SSH时,我安装的所有包裹都安装在我的假体上,我的虚拟环境已经消失。

曾经在Vagrant SSH建立发展环境的最佳做法是什么?

Currently i have done:
1) Vagrant SSH
2) Installed default python packages (pip, dev, git, etc.)
3) Install Virtual env
4) CD to shared folder (ie /vagrant)
5) Create virtual env ( virtualenv env_name )
6) Source virtual env (source env_name/bin/activate)
7) Install Virtual env pkgs (ie. Django, pyscho2, etc.)

Once im done for the day:

8) deactivate virtual env
9) exit out of ssh
10) vagrant halt

这是否一般是正确的工作流程? 我特别混淆了第5步。 难道这是制造虚拟面纱的正确方法,还是我是否对不同的手套(理论从手头开始,有点/秒)表示不满意? 适当关闭物品?

Any help would be appreciated - Thanks in advance!

Edit:我刚刚注意到,虚拟箱有几本我准确的盒子。 这可能是造成失踪的恩夫和已经安装的包裹的原因。 似乎在做一些错误的pin子,.倒 instance。

问题回答

Using virtualenv with Vagrant in the gswd tutorial is slightly more tricky than normal virtual env work because of where the virutal environment is stored.

这里的一个例子是,我创建了1个Vagrant的病毒包罗维,使之丧失活力,并创造了2个虚拟平台:

vagrant@precise64:/vagrant/projects$* virtualenv ~/blog-venv1

- note that in the above line we are through a path to the actual env

vagrant@precise64:/vagrant/projects$* source ~/blog-venv1/bin/activate
(blog-venv1)vagrant@precise64:/vagrant/projects/$* deactivate
vagrant@precise64:/vagrant/projects$* virtualenv ~/blog-venv2
vagrant@precise64:/vagrant/projects2$* source ~/blog-venv2/bin/activate




相关问题
Can Django models use MySQL functions?

Is there a way to force Django models to pass a field to a MySQL function every time the model data is read or loaded? To clarify what I mean in SQL, I want the Django model to produce something like ...

An enterprise scheduler for python (like quartz)

I am looking for an enterprise tasks scheduler for python, like quartz is for Java. Requirements: Persistent: if the process restarts or the machine restarts, then all the jobs must stay there and ...

How to remove unique, then duplicate dictionaries in a list?

Given the following list that contains some duplicate and some unique dictionaries, what is the best method to remove unique dictionaries first, then reduce the duplicate dictionaries to single ...

What is suggested seed value to use with random.seed()?

Simple enough question: I m using python random module to generate random integers. I want to know what is the suggested value to use with the random.seed() function? Currently I am letting this ...

How can I make the PyDev editor selectively ignore errors?

I m using PyDev under Eclipse to write some Jython code. I ve got numerous instances where I need to do something like this: import com.work.project.component.client.Interface.ISubInterface as ...

How do I profile `paster serve` s startup time?

Python s paster serve app.ini is taking longer than I would like to be ready for the first request. I know how to profile requests with middleware, but how do I profile the initialization time? I ...

Pragmatically adding give-aways/freebies to an online store

Our business currently has an online store and recently we ve been offering free specials to our customers. Right now, we simply display the special and give the buyer a notice stating we will add the ...

Converting Dictionary to List? [duplicate]

I m trying to convert a Python dictionary into a Python list, in order to perform some calculations. #My dictionary dict = {} dict[ Capital ]="London" dict[ Food ]="Fish&Chips" dict[ 2012 ]="...

热门标签