commit | author | age
|
88995e
|
1 |
from pyramid.config import Configurator |
SP |
2 |
from pyramid_zodbconn import get_connection |
|
3 |
from .models import appmaker |
|
4 |
|
|
5 |
|
|
6 |
def root_factory(request): |
|
7 |
conn = get_connection(request) |
|
8 |
return appmaker(conn.root()) |
|
9 |
|
|
10 |
|
|
11 |
def main(global_config, **settings): |
|
12 |
""" This function returns a Pyramid WSGI application. |
|
13 |
""" |
|
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' |
88995e
|
17 |
config.include('pyramid_chameleon') |
81bf14
|
18 |
config.include('pyramid_tm') |
85623b
|
19 |
config.include('pyramid_retry') |
81bf14
|
20 |
config.include('pyramid_zodbconn') |
88995e
|
21 |
config.add_static_view('static', 'static', cache_max_age=3600) |
SP |
22 |
config.scan() |
|
23 |
return config.make_wsgi_app() |