5c3a95915b
all the views are still visible in our app, but the view logic belongs in tailbone-corepos now
41 lines
1.3 KiB
Python
41 lines
1.3 KiB
Python
# -*- coding: utf-8; -*-
|
|
"""
|
|
Pyramid web application
|
|
"""
|
|
|
|
from __future__ import unicode_literals, absolute_import
|
|
|
|
from tailbone import app
|
|
from tailbone_corepos.db import CoreOfficeSession, CoreTransSession
|
|
|
|
|
|
def main(global_config, **settings):
|
|
"""
|
|
This function returns a Pyramid WSGI application.
|
|
"""
|
|
# prefer demo templates over tailbone
|
|
settings.setdefault('mako.directories', ['rattail_demo.web:templates',
|
|
'tailbone:templates',])
|
|
|
|
# for graceful handling of postgres restart
|
|
settings.setdefault('retry.attempts', 2)
|
|
|
|
# make config objects
|
|
rattail_config = app.make_rattail_config(settings)
|
|
pyramid_config = app.make_pyramid_config(settings)
|
|
|
|
# configure database sessions
|
|
CoreOfficeSession.configure(bind=rattail_config.corepos_engine)
|
|
CoreTransSession.configure(bind=rattail_config.coretrans_engine)
|
|
|
|
# bring in rest of rattail-demo etc.
|
|
pyramid_config.include('tailbone.static')
|
|
pyramid_config.include('rattail_demo.web.subscribers')
|
|
pyramid_config.include('rattail_demo.web.views')
|
|
|
|
# for graceful handling of postgres restart
|
|
pyramid_config.add_tween('tailbone.tweens.sqlerror_tween_factory',
|
|
under='pyramid_tm.tm_tween_factory')
|
|
|
|
return pyramid_config.make_wsgi_app()
|