source: rattail/rattail/data/project/+package+/web/app.py_tmpl @ 86c3621

Last change on this file since 86c3621 was 86c3621, checked in by Lance Edgar <ledgar@…>, 11 months ago

Some improvements to basic project template

  • Property mode set to 100644
File size: 1.1 KB
Line 
1# -*- coding: utf-8; mode: python; -*-
2"""
3{{project_title}} web app
4"""
5
6from __future__ import unicode_literals, absolute_import
7
8from tailbone import app
9
10
11def main(global_config, **settings):
12    """
13    This function returns a Pyramid WSGI application.
14    """
15    # prefer {{project_title}} templates over Tailbone
16    settings.setdefault('mako.directories', ['{{package}}.web:templates',
17                                             'tailbone:templates',])
18
19    # for graceful handling of postgres restart
20    settings.setdefault('retry.attempts', 2)
21
22    # make config objects
23    rattail_config = app.make_rattail_config(settings)
24    pyramid_config = app.make_pyramid_config(settings)
25
26    # bring in the rest of {{project_title}}
27    pyramid_config.include('{{package}}.web.static')
28    pyramid_config.include('{{package}}.web.subscribers')
29    pyramid_config.include('{{package}}.web.views')
30
31    # for graceful handling of postgres restart
32    pyramid_config.add_tween('tailbone.tweens.sqlerror_tween_factory',
33                             under='pyramid_tm.tm_tween_factory')
34
35    return pyramid_config.make_wsgi_app()
Note: See TracBrowser for help on using the repository browser.