如何在同一台机器上为不同的项目使用两个不同版本的Django?

时间:2021-09-13 02:38:59

I'm currently using Django 1.0 on my Mac OS X 10.5.7 box. It's installed to:

我目前在Mac OS X 10.5.7盒子上使用Django 1.0。它被安装到:

/Library/Python/2.5/site-packages/django/

/Library/Python/2.5/site-packages/django/

However, there are features that are part of the development release (1.1) of django that I'd love to use for internal tools at my company. Unfortunately I can't just update to the development version because I still need to develop on the 1.0 version for my production code.

但是,有一些功能是django的开发版本(1.1)的一部分,我喜欢在我的公司使用内部工具。不幸的是,我不能只更新到开发版本,因为我仍然需要为我的生产代码开发1.0版本。

Is there an easy way (on Mac OSX) to have two versions of Django installed? Once 1.1 is installed, how do I tell a given project to use one version vs. the other?

是否有一种简单的方法(在Mac OSX上)安装了两个版本的Django?安装1.1之后,如何告诉给定项目使用一个版本而不是另一个版本?

Many thanks for the help!

非常感谢您的帮助!

Update Thanks all for the suggestions. Virtualenv seems like the way to go, and here's a blog post on how to use it with Django specifically: http://justindriscoll.us/2008/11/setting-up-django-development-virtual.html

更新全部感谢您的建议。 Virtualenv似乎是要走的路,这里有关于如何与Django一起使用它的博客文章:http://justindriscoll.us/2008/11/setting-up-django-development-virtual.html

S.O. to the rescue yet again :)

所以。再次救援:)

6 个解决方案

#1


11  

zc.buildout (esp. for deployment) and virtualenv (esp. for development) were Jacob Kaplan Moss's top suggestions at the "Django in the real world" tutorial he gave at OSCON today, though he did mention many other tools -- see his slides on O'Reilly's site.

zc.buildout(尤其是部署)和virtualenv(特别是开发)是Jacob Kaplan Moss在今天在OSCON上给出的“现实世界中的Django”教程中的最佳建议,尽管他确实提到了许多其他工具 - 请参阅他的O'Reilly网站上的幻灯片。

#2


6  

You may want to consider using something like Virtualenv. It allows you to set up multiple isolated Python environments. So, not only could you have multiple Djangos, but you could have different versions of Python running as well.

你可能想考虑使用像Virtualenv这样的东西。它允许您设置多个隔离的Python环境。因此,您不仅可以拥有多个Djangos,而且还可以运行不同版本的Python。

Zed Shaw created a screen cast of setting up Virtualenv, although not with Django specifically, (he shows how to get his mail software, Lamson, up and running). However, the concepts also work for setting up multiple versions of Django on the same machine with Virtualenv.

Zed Shaw创建了一个设置Virtualenv的屏幕演员,虽然不是专门用于Django(他展示了如何获得他的邮件软件,Lamson,启动和运行)。但是,这些概念也适用于在与Virtualenv相同的机器上设置多个版本的Django。

#3


3  

Take a look at virtualenv http://pypi.python.org/pypi/virtualenv It helps you keep contained environments. Pinax uses it. http://www.pinaxproject.com

看看virtualenv http://pypi.python.org/pypi/virtualenv它可以帮助您保持包含的环境。 Pinax使用它。 http://www.pinaxproject.com

#4


2  

virtualenv

的virtualenv

#5


0  

virtualenvwrappper make virtualenv easier. http://pypi.python.org/pypi/virtualenvwrapper

virtualenvwrappper使virtualenv更容易。 http://pypi.python.org/pypi/virtualenvwrapper

#6


0  

You can use different users at operating system level. It works nice on linux, and I guess it should work on Mac, too.

您可以在操作系统级别使用不同的用户。它在linux上工作得很好,我想它也适用于Mac。

You can install django and other packages into the per user site-packages directory:

您可以将django和其他软件包安装到每个用户的site-packages目录中:

http://www.python.org/dev/peps/pep-0370/

http://www.python.org/dev/peps/pep-0370/

Related: Do I need virtualenv?

相关:我需要virtualenv吗?

#1


11  

zc.buildout (esp. for deployment) and virtualenv (esp. for development) were Jacob Kaplan Moss's top suggestions at the "Django in the real world" tutorial he gave at OSCON today, though he did mention many other tools -- see his slides on O'Reilly's site.

zc.buildout(尤其是部署)和virtualenv(特别是开发)是Jacob Kaplan Moss在今天在OSCON上给出的“现实世界中的Django”教程中的最佳建议,尽管他确实提到了许多其他工具 - 请参阅他的O'Reilly网站上的幻灯片。

#2


6  

You may want to consider using something like Virtualenv. It allows you to set up multiple isolated Python environments. So, not only could you have multiple Djangos, but you could have different versions of Python running as well.

你可能想考虑使用像Virtualenv这样的东西。它允许您设置多个隔离的Python环境。因此,您不仅可以拥有多个Djangos,而且还可以运行不同版本的Python。

Zed Shaw created a screen cast of setting up Virtualenv, although not with Django specifically, (he shows how to get his mail software, Lamson, up and running). However, the concepts also work for setting up multiple versions of Django on the same machine with Virtualenv.

Zed Shaw创建了一个设置Virtualenv的屏幕演员,虽然不是专门用于Django(他展示了如何获得他的邮件软件,Lamson,启动和运行)。但是,这些概念也适用于在与Virtualenv相同的机器上设置多个版本的Django。

#3


3  

Take a look at virtualenv http://pypi.python.org/pypi/virtualenv It helps you keep contained environments. Pinax uses it. http://www.pinaxproject.com

看看virtualenv http://pypi.python.org/pypi/virtualenv它可以帮助您保持包含的环境。 Pinax使用它。 http://www.pinaxproject.com

#4


2  

virtualenv

的virtualenv

#5


0  

virtualenvwrappper make virtualenv easier. http://pypi.python.org/pypi/virtualenvwrapper

virtualenvwrappper使virtualenv更容易。 http://pypi.python.org/pypi/virtualenvwrapper

#6


0  

You can use different users at operating system level. It works nice on linux, and I guess it should work on Mac, too.

您可以在操作系统级别使用不同的用户。它在linux上工作得很好,我想它也适用于Mac。

You can install django and other packages into the per user site-packages directory:

您可以将django和其他软件包安装到每个用户的site-packages目录中:

http://www.python.org/dev/peps/pep-0370/

http://www.python.org/dev/peps/pep-0370/

Related: Do I need virtualenv?

相关:我需要virtualenv吗?