| 1 |
from paste import httpexceptions
|
| 2 |
from paste.registry import RegistryManager
|
| 3 |
from paste.deploy.converters import asbool
|
| 4 |
from turbogears.cputils import Tree, start_cp_engine
|
| 5 |
from turbogears.middleware import ErrorHandler, make_config_filter
|
| 6 |
|
| 7 |
from ${package}.controllers import Root
|
| 8 |
|
| 9 |
|
| 10 |
def make_app(global_conf, full_stack=True, **app_conf):
|
| 11 |
"""This function is a paste.app_factory entry_point which will take care
|
| 12 |
of building your WSGI application object."""
|
| 13 |
|
| 14 |
tree = Tree()
|
| 15 |
tree.mount(Root(), '/')
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
app_conf['request.throw_errors'] = True
|
| 22 |
app = make_config_filter(tree, global_conf, **app_conf)
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
if asbool(full_stack):
|
| 29 |
app = httpexceptions.make_middleware(app, global_conf)
|
| 30 |
app = ErrorHandler(app, global_conf)
|
| 31 |
|
| 32 |
|
| 33 |
app = RegistryManager(app)
|
| 34 |
|
| 35 |
|
| 36 |
start_cp_engine()
|
| 37 |
return app
|