Reputation: 26882
I was wondering what this snippet exactly does?
(found here: http://code.google.com/p/google-app-engine-samples/source/browse/trunk/django_example/django_bootstrap.py)
# Make sure we can import Django. We may end up needing to do this
# little dance, courtesy of Google third-party versioning hacks. Note
# that this patches up sys.modules, so all other code can just use
# "from django import forms" etc.
try:
from django import v0_96 as django
except ImportError:
pass
Upvotes: 0
Views: 191
Reputation: 13496
As I stated in another question before, you can use different django versions in app engine (starting from 0.96 up to 1.2 currently). By default it is still using 0.96 as django (and this is what this code snippet does). Though you can change this by adding something like the following to your main.py
:
import os
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
from google.appengine.dist import use_library
use_library('django', '1.2')
Upvotes: 3