Add support for simple postgres restart

This commit is contained in:
Lance Edgar 2019-03-03 13:10:08 -06:00
parent 520940bc81
commit b1875f5834

View file

@ -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()