Monday, November 15, 2010

App Engine Helper for Django - Part I

Even with the easy instructions on installing GAE Django Helper I ran into several problems. Most of these were Import Error.

from google.appengine.ext import db
ImportError: No module named google.appengine.ext

django.core.exceptions.ImproperlyConfigured: 'appengine' isn't an available database backend. 
Try using django.db.backends.XXX, where XXX is one of:
    'dummy', 'mysql', 'oracle', 'postgresql', 'postgresql_psycopg2', 'sqlite3'
Error was: No module named appengine.base

google.appengine.dist._library.UnacceptableVersionError

Turns out settings.py was not pointing correctly to appengine_django. I had copied the app directory to my project's directory but the path didn't include the project name. The app was still running fine when using launcher. 

Here's how the correct entry should look

INSTALLED_APPS = (
     'djproject.appengine_django',
     'djprorject.mydjapp',
#    'django.contrib.auth',
#    'django.contrib.contenttypes',
#    'django.contrib.sessions',
#    'django.contrib.sites',
)

Another point, although instructions here say that you don't need django.zip in your project folder...it didn't work for me without it.

I will do another post giving step by step for using django helper for GAE.

Here's a successful run of runserver with django and GAE helper.

ruch:djproject ruchi$ ./manage.py runserver
WARNING:root:Could not read datastore data from /var/folders/d9/d92Wee6VGY4YhfNUP1rgnU+++TM/-Tmp-/django_mixq.datastore
WARNING:root:Could not initialize images API; you are likely missing the Python "PIL" module. ImportError: No module named _imaging
INFO:root:zipimporter('/Users/ruchi/djproject/django.zip', 'django/contrib/')
INFO:google.appengine.tools.appengine_rpc:Server: appengine.google.com
INFO:root:Checking for updates to the SDK.
INFO:root:The SDK is up to date.
WARNING:root:Could not read datastore data from /var/folders/d9/d92Wee6VGY4YhfNUP1rgnU+++TM/-Tmp-/django_mixq.datastore
WARNING:root:Could not initialize images API; you are likely missing the Python "PIL" module. ImportError: No module named _imaging
INFO:root:Running application mydjapp on port 8000: http://localhost:8000

No comments: