Django 1.4 Install Issues

software development



I’m trying to give python a try with Django for a site. I want to use Django 1.4 instead of the installed 1.2.1.

I followed this tutorial:

So far, I can open up python, import django and check the version (django.get_version()) - It’s 1.4 as it should be.

I setup my application/project using and it loads up:

The problem is passenger seems to be loading django 1.2.1, not 1.4. My looks like the following (I’ve replaced usernames with ):

import sys, os, django

log = file('/home/<username>/passengerwsgi.log', 'a')
print >>log, "Running %s version %s" % (sys.executable, sys.version)
print >>log, "Running django version %s" % (django.get_version())
print >>log, "------------------------"


os.environ['DJANGO_SETTINGS_MODULE'] = "stockr.settings"
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

I added the logging code to see what version was being loaded and I get:

Running /usr/bin/python version 2.5.2 (r252:60911, Jan 24 2010, 17:44:40)
[GCC 4.3.2]
Running django version 1.2.1

What am I doing wrong? Is there some setup I am missing?

Any help would be appreciated.



You’re importing django before you add the path to your copy of it, so you end up loading the system copy. Remove “django” from the imports on the first line, and add “import django” later on.


andrewf: Thanks for the catch. So I guess, Django 1.4 IS being picked up.

I had other issues with templates (admin templates weren’t installed) and the that’s provided by the wiki doesn’t create superusers properly. So I wasn’t able to login either.

Sorry for the trouble.