开发者

How do you specify which django version to use?

开发者 https://www.devze.com 2023-01-29 22:46 出处:网络
I am using ubuntu and I have installed django from the Ubuntu Software Center. For some projects I want to use the django cloned from the trunk instead of the default one. How can i do that ? Do I nee

I am using ubuntu and I have installed django from the Ubuntu Software Center. For some projects I want to use the django cloned from the trunk instead of the default one. How can i do that ? Do I need to unistall t开发者_开发问答he one provided by ubuntu?


Create a virtualenv for your django (with --no-site-packages) and activate it. Then install everything you need inside it.


No, simply make sure that the one you want to use shows up in an earlier directory in sys.path.


if wsgi in use then set the path to the desired django installation in the django.wsgi file. eg

import os
import sys
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
sys.path[:0] = ['/path/to/django/version/','/path/to/project/']
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

If modpython then set the path in the apache configuration file

PythonPath "['/path/to/django/version','/path/to/project'] + sys.path"

The docs might help: http://docs.djangoproject.com/en/dev/howto/deployment/modpython/

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号