Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Yes. Django is just a regular Python module living in your <strong>site-packages</strong>. So when you <code>import django.something</code>, the way Python decides which version to load is by walking down the Python path (<code>import sys; print sys.path</code>) in order and looking for a directory called django (with <strong>something.py</strong> or <strong>something/_<em>init</em>_.py</strong> inside). It loads the first one it finds. So the quickest method is to modify this Python path before starting your project, which can be conveniently done with an environment variable named PYTHONPATH.</p> <p>So for your Django 1.2 project, install Django 1.2 in site-packages/django-1.2 and then:</p> <pre><code># run Django 1.2 for old app that I don't have time to update cd ~gaearon/src/old-django-project env PYTHONPATH=/Library/Python/2.6/site-packages/django-1.2 ./manage.py runserver </code></pre> <p>For all other (Django 1.3) projects, simply install Django as normal, which makes it the default:</p> <pre><code># all other projects use the system default Django 1.3 cd ~gaearon/src/current-django-project ./manage.py runserver </code></pre> <p>For production servers you won't use runserver, but the PYTHONPATH will work wherever you invoke Python (i.e. flup, or manage.py runfcgi). If invoked from mod_python there is an Apache configuration directive to modify the Python path (see mod_python documentation).</p> <p>Or you could use <a href="http://www.virtualenv.org/en/latest/index.html#what-it-does" rel="nofollow">virtualenv</a>.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload