diff --git a/rattail_demo/web/app.py b/rattail_demo/web/app.py index 26858dc..bfcb7a7 100644 --- a/rattail_demo/web/app.py +++ b/rattail_demo/web/app.py @@ -14,13 +14,13 @@ def main(global_config, **settings): """ This function returns a Pyramid WSGI application. """ - # set some defaults for postgres - app.provide_postgresql_settings(settings) - # 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) @@ -34,4 +34,8 @@ def main(global_config, **settings): 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()