import os
if os.getenv('SERVER_SOFTWARE', '').startswith('Google App Engine'):
    DATABASES = {'default': {'ENGINE': 'django.db.backends.mysql', 'HOST':
        '/cloudsql/your-project-id:your-instance-name', 'NAME':
        'django_test', 'USER': 'root'}}
elif os.getenv('SETTINGS_MODE') == 'prod':
    DATABASES = {'default': {'ENGINE':
        'google.appengine.ext.django.backends.rdbms', 'INSTANCE':
        'your-project-id:your-instance-name', 'NAME': 'django_test', 'USER':
        'root'}}
else:
    DATABASES = {'default': {'ENGINE': 'django.db.backends.mysql', 'NAME':
        'django_test', 'USER': 'root', 'PASSWORD': 'root'}}
Django на Google App Engine с Cloud SQL в среде разработки