Virtualenv和源版本控制

Virtualenv和源版本控制

本文介绍了Virtualenv和源版本控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近刚刚开始一个Django项目,很快就意识到,virtualenv将会因为很多原因而非常有用。我设置了virtualenv和我的项目,但是现在我想知道我应该添加什么文件到我的源代码控件(在我的例子中,Mercurial)。我应该将所有文件添加到venv文件夹下吗?

解决方案

你会生成一个同事可以克隆并立即开始工作您的项目提交的需求文件(通常为 requirements.txt ):

 code>点击冻结>每个开发人员将设置自己的virtualenv并运行:

$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $

  pip install -r requirements.txt 


I recently started a Django project and I quickly realized that virtualenv will be really useful for many reasons. I set up the virtualenv and my project, but now I wonder what file I should add to my source control (in my case, Mercurial). Should I add all the files under the venv folder? How do I make sure a colleague can clone and get started to work immediately withou having to setup the env again?

解决方案

You generate a "requirements" file (usually requirements.txt) that you commit with your project:

pip freeze > requirements.txt

Then, each developer will set up their own virtualenv and run:

pip install -r requirements.txt

这篇关于Virtualenv和源版本控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 03:17