Skip to content

Instantly share code, notes, and snippets.

@justhamade
Created July 6, 2013 00:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justhamade/5937983 to your computer and use it in GitHub Desktop.
Save justhamade/5937983 to your computer and use it in GitHub Desktop.
Stackto Blog Post Snippets
import urlparse
DATABASES = {}
if 'DATABASE_URL' in os.environ:
url = urlparse.urlparse(os.environ['DATABASE_URL'])
DATABASES['default'] = {
'NAME': url.path[1:],
'USER': url.username,
'PASSWORD': url.password,
'HOST': url.hostname,
'PORT': url.port,
}
if url.scheme == 'postgres':
DATABASES['default']['ENGINE'] = 'django.db.backends.postgresql_psycopg2'
elif url.scheme == 'mysql':
DATABASES['default']['ENGINE'] = 'django.db.backends.mysql'
else:
DATABASES['default'] = {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'dev.db', # Or path to database file if using sqlite3.
'USER': '', # Not used with sqlite3.
'PASSWORD': '', # Not used with sqlite3.
'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '', # Set to empty string for default. Not used with sqlite3.
}
name: stackto-demo
framework:
type: python
runtime: python27
min_version:
client: 1.5.1
env:
DJANGO_SETTINGS_MODULE: settings.production
requirements:
pip:
- mysql-python
- django
- south
- django-bootstrap-forms
- mock
- gdata
- django-mobile
- pycrypto
- django-compress
- django-recaptcha
- django-cache-machine
- django-extensions
- gunicorn
- python-memcached
services:
${name}-db: mysql
${name}-memcached: memcached
processes:
web: $STACKATO_UWSGI --check-static $HOME/static --check-static $HOME/media
hooks:
post-staging:
- python manage.py syncdb --noinput
- python manage.py migrate --noinput
- python manage.py collectstatic --noinput
ignores:
- .git
- dev.db
stackato update
stackato target api.stackto-xxxx.local
stackato push
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment