Running Google App Engine Helper trunk with Django trunk (zipimport)
Dan Sanderson has a good article on Google Code on Using Django 1.0 on App Engine with Zipimport, however it misses two steps in preparing the django.zip file if you want to use the latest Django trunk with the latest Google App Engine Helper.
To create a new Django application for Google App Engine using Google App Engine Helper, start by exporting the latest Google App Engine Helper:
svn export http://google-app-engine-django.googlecode.com/svn/trunk/ ~/myapp
To create a django.zip file to use with the latest Google App Engine:
- Export the latest Django trunk
svn export http://code.djangoproject.com/svn/django/trunk/ django
- Follow steps #2 and #3 in Dan's instructions under the "Archiving Django 1.0" section of his article
- Add contrib/auth:
zip -r django.zip django/contrib/__init__.py \ django/contrib/auth
- Add contrib/sessions:
zip -r django.zip django/contrib/__init__.py \ django/contrib/sessions
- Copy the django.zip file into the root folder of your new app:
cp django.zip ~/myapp
- Uncomment the sessions middleware or auth middleware lines in settings.py file in your app so that it looks like:
MIDDLEWARE_CLASSES = ( 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', # 'django.middleware.doc.XViewMiddleware', )
That's it! To test it out:
./manage.py runserver
Hit http://localhost:8000/ and you should see the default Django welcome page.
Update: Don't make the mistake of adding django.contrib.auth or django.contrib.sessions to your INSTALLED_APPS, even though you are including those apps in the django.zip file. If you do, ./manage.py runserver will work but ./manage.py shell and ./manage.py flush will return errors.
Comments
by Andr.in on 2009-05-07 18:24:55