Deploying Django app to Google App Engine using Google Cloud SQL

I'm trying to deploy my Django app to Google App Engine (GAE) as per:

I created and configured a Google Cloud SQL instance, as described in that document. I use PyCharm as development environment and created a GAE project with Django support.

In PyCharm Settings under Python Interpreter -> Paths, I added the Django 1.4 version as distributed with GAE SDK.

My database is defined as (as per above document):
    'default': {
        'ENGINE': 'google.appengine.ext.django.backends.rdbms',
        'INSTANCE': 'my_project:instance1',
        'NAME': 'my_database',

When I start GAE local server and attempt a SYNCDB task, it results in a stack trace with:

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

Any help is much appreciated!
Comment actions Permalink
I suppose you use syncdb from the command line?
Looks like syncdb is using the wrong Django installation.
The google.appengine.ext.django.backends.rdbms is not part of the official Django distribution, but it is part of GAEs django.
My GAE django is in /usr/local/google_appengine/lib/

If you're on linux you could add this to your .bashrc and make syncdb use this:
export GAE="/usr/local/google_appengine"
export PYTHONPATH="$PYTHONPATH:$GAE:$GAE/lib/django_1_4"
export PATH=${PATH}:$GAE/lib/django_1_4/django/bin/
export PATH=${PATH}:/usr/local/mysql/bin

Btw: the official GAE support is on stackoverflow. You probably get answers faster there.
Comment actions Permalink

I originally posted on SO:

So far no luck there.

I am on Mac OS X. I used syncdb from Pycharm's Tools->Run Task. Not sure whether that's different from running it from a Terminal window.

I suppose your solution on the PYTHONPATH should work equally for OS X. I'll give that a try tomorrow as I'm not at my machine at the moment.
Comment actions Permalink
I adapted my comment and posted it on stackoverflow - so the discussion keeps at one place

Please sign in to leave a comment.