vigiboard / vigiboard / config / middleware.py @ 20367931
History | View | Annotate | Download (1.46 KB)
1 |
# -*- coding: utf-8 -*-
|
---|---|
2 |
"""WSGI middleware initialization for the vigiboard application."""
|
3 |
|
4 |
from vigiboard.config.app_cfg import base_config |
5 |
from vigiboard.config.environment import load_environment |
6 |
from vigiboard.config.vigiboard_config import vigiboard_config |
7 |
|
8 |
__all__ = ['make_app']
|
9 |
|
10 |
# Use base_config to setup the necessary PasteDeploy application factory.
|
11 |
# make_base_app will wrap the TG2 app with all the middleware it needs.
|
12 |
make_base_app = base_config.setup_tg_wsgi_app(load_environment) |
13 |
|
14 |
|
15 |
def make_app(global_conf, full_stack=True, **app_conf): |
16 |
"""
|
17 |
Set vigiboard up with the settings found in the PasteDeploy configuration
|
18 |
file used.
|
19 |
|
20 |
:param global_conf: The global settings for vigiboard (those
|
21 |
defined under the ``[DEFAULT]`` section).
|
22 |
:type global_conf: dict
|
23 |
:param full_stack: Should the whole TG2 stack be set up?
|
24 |
:type full_stack: str or bool
|
25 |
:return: The vigiboard application with all the relevant middleware
|
26 |
loaded.
|
27 |
|
28 |
This is the PasteDeploy factory for the vigiboard application.
|
29 |
|
30 |
``app_conf`` contains all the application-specific settings (those defined
|
31 |
under ``[app:main]``.
|
32 |
|
33 |
|
34 |
"""
|
35 |
|
36 |
# Petit hack permettant d'importer la configuration de vigiboard
|
37 |
|
38 |
for i in vigiboard_config : |
39 |
app_conf[i] = vigiboard_config[i] |
40 |
|
41 |
app = make_base_app(global_conf, full_stack=True, **app_conf)
|
42 |
|
43 |
# Wrap your base TurboGears 2 application with custom middleware here
|
44 |
|
45 |
return app
|