Workout With Friends Stay fit with a little motivation

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Properties
__init__.py
Go to the documentation of this file.
1 import os
2 import time
3 from pyramid.authentication import SessionAuthenticationPolicy
4 from pyramid.authorization import ACLAuthorizationPolicy
5 from pyramid.config import Configurator
6 from pyramid_beaker import session_factory_from_settings, set_cache_regions_from_settings
7 from wowf.config import globalize_settings, routes
8 from wowf.lib.predicates import LoggedIn, RequestMethod, RouteName
9 from wowf.lib.requests import RequestFactory
10 from wowf.lib.resources import RootFactory
11 from wowf.models import initialize_sqla
12
13
14 ##
15 #
16 # Configure and return a WSGI application.
17 #
18 def main(global_config, **settings):
19 globalize_settings(settings)
20 initialize_sqla(settings)
21 set_cache_regions_from_settings(settings)
22 config = Configurator(
23 settings=settings,
24 request_factory=RequestFactory,
25 root_factory=RootFactory,
26 authentication_policy=SessionAuthenticationPolicy(),
27 authorization_policy=ACLAuthorizationPolicy(),
28 session_factory=session_factory_from_settings(settings))
29 config.include('pyramid_jinja2')
30 config.include('pyramid_mailer')
31 config.include('pyramid_rewrite')
32 config.include('pyramid_tm')
33 config.include(routes)
34 config.add_renderer('.html', 'pyramid_jinja2.renderer_factory')
35 config.add_static_view(settings['static_url'], 'wowf:static')
36 config.add_static_view(settings['avatar_url'], settings['avatar_dir'])
37 config.add_view_predicate('logged_in', LoggedIn)
38 config.add_subscriber_predicate('route_name', RouteName)
39 config.add_subscriber_predicate('request_method', RequestMethod)
40 config.scan('wowf.views')
41 config.scan('wowf.lib.subscribers')
42 os.environ['TZ'] = settings['timezone']
43 time.tzset()
44 return config.make_wsgi_app()
45