commit | author | age
|
aff443
|
1 |
from pyramid.config import Configurator |
b25335
|
2 |
from pyramid_zodbconn import get_connection |
7d2f14
|
3 |
from .models import appmaker |
b25335
|
4 |
|
877eeb
|
5 |
|
b25335
|
6 |
def root_factory(request): |
CM |
7 |
conn = get_connection(request) |
|
8 |
return appmaker(conn.root()) |
6ac10b
|
9 |
|
877eeb
|
10 |
|
9cca72
|
11 |
def main(global_config, **settings): |
c44c40
|
12 |
""" This function returns a Pyramid WSGI application. |
6ac10b
|
13 |
""" |
b25335
|
14 |
config = Configurator(root_factory=root_factory, settings=settings) |
ed7bad
|
15 |
settings = config.get_settings() |
CM |
16 |
settings['tm.manager_hook'] = 'pyramid_tm.explicit_manager' |
b28964
|
17 |
config.include('pyramid_chameleon') |
7d2f14
|
18 |
config.add_static_view('static', 'static', cache_max_age=3600) |
CM |
19 |
config.scan() |
6ac10b
|
20 |
return config.make_wsgi_app() |