Created
November 13, 2013 02:00
-
-
Save inklesspen/7442308 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# 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