How can you use two different versions of Django f

2020-02-10 14:27发布

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

/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.

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?

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

S.O. to the rescue yet again :)

标签: django
6条回答
爷、活的狠高调
2楼-- · 2020-02-10 14:44

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.

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.

查看更多
▲ chillily
3楼-- · 2020-02-10 14:45

virtualenv

查看更多
倾城 Initia
4楼-- · 2020-02-10 14:47

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

查看更多
smile是对你的礼貌
5楼-- · 2020-02-10 15:01

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

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

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

Related: Do I need virtualenv?

查看更多
我想做一个坏孩纸
6楼-- · 2020-02-10 15:02

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.

查看更多
smile是对你的礼貌
7楼-- · 2020-02-10 15:07

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

查看更多
登录 后发表回答