Created
July 6, 2013 00:15
-
-
Save justhamade/5937983 to your computer and use it in GitHub Desktop.
Stackto Blog Post Snippets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stackato update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stackato ssh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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