Skip to content

Instantly share code, notes, and snippets.

@inklesspen
Created November 13, 2013 02:00
Show Gist options
  • Save inklesspen/7442308 to your computer and use it in GitHub Desktop.
Save inklesspen/7442308 to your computer and use it in GitHub Desktop.
# in your ini file, have this:
# env.use_env_variables = true
# sqlalchemy.url = DATABASE_URL
# then, in your __init__.py file, the first thing you do in your main function is this:
def main(global_config, **settings):
""" This function returns a Pyramid WSGI application.
"""
from pyramid.settings import asbool
if asbool(settings.get('env.use_env_variables', False)):
from os import getenv
settings['sqlalchemy.url'] = getenv(settings['sqlalchemy.url'])
config = Configurator(settings=settings)
# blah blah blah
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment