Skip to content

Instantly share code, notes, and snippets.

@jamesrwhite
Created October 10, 2013 13:32
Show Gist options
  • Save jamesrwhite/6918370 to your computer and use it in GitHub Desktop.
Save jamesrwhite/6918370 to your computer and use it in GitHub Desktop.
Switching Django configs on Google App Engine
# Database configs, only one of those will be chosen based on the env
database_configs = {
'development': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'wina',
'USER': 'django',
'PASSWORD': 'password',
'HOST': '127.0.0.1',
'PORT': '3306',
},
'production': {
'ENGINE': 'django.db.backends.mysql',
'NAME': '',
'USER': '',
'PASSWORD': '',
'HOST': '',
'PORT': '',
}
}
DATABASES = {
'default': database_configs['production'] if os.getenv('SERVER_SOFTWARE') and os.getenv('SERVER_SOFTWARE').startswith('Google App Engine/') else database_configs['development']
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment