Michael Merickel
2017-06-11 06c28384c1217e054f530df511b434ff543e3132
commit | author | age
d7f259 1 from pyramid.config import Configurator
b25335 2 from pyramid_zodbconn import get_connection
6d1eee 3 from .models import appmaker
PP 4
b25335 5
CM 6 def root_factory(request):
7     conn = get_connection(request)
8     return appmaker(conn.root())
b3b713 9
6d1eee 10
c44c40 11 def main(global_config, **settings):
6d1eee 12     """ This function returns a Pyramid WSGI application.
b3b713 13     """
b25335 14     config = Configurator(root_factory=root_factory, settings=settings)
85623b 15     settings = config.get_settings()
SP 16     settings['tm.manager_hook'] = 'pyramid_tm.explicit_manager'
404b28 17     config.include('pyramid_chameleon')
e03ea9 18     config.include('pyramid_tm')
85623b 19     config.include('pyramid_retry')
e03ea9 20     config.include('pyramid_zodbconn')
4466bb 21     config.add_static_view('static', 'static', cache_max_age=3600)
6d1eee 22     config.scan()
b3b713 23     return config.make_wsgi_app()