Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

vigiboard / dashboard / config / middleware.py @ 805cc54a

History | View | Annotate | Download (1.39 KB)

1
# -*- coding: utf-8 -*-
2
"""WSGI middleware initialization for the dashboard application."""
3

    
4
from dashboard.config.app_cfg import base_config
5
from dashboard.config.environment import load_environment
6
from dashboard.config.dashboard_config import dashboard_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
def make_app(global_conf, full_stack=True, **app_conf):
15
    """
16
    Set dashboard up with the settings found in the PasteDeploy configuration
17
    file used.
18
    
19
    :param global_conf: The global settings for dashboard (those
20
        defined under the ``[DEFAULT]`` section).
21
    :type global_conf: dict
22
    :param full_stack: Should the whole TG2 stack be set up?
23
    :type full_stack: str or bool
24
    :return: The dashboard application with all the relevant middleware
25
        loaded.
26
    
27
    This is the PasteDeploy factory for the dashboard application.
28
    
29
    ``app_conf`` contains all the application-specific settings (those defined
30
    under ``[app:main]``.
31
    
32
   
33
    """
34
    
35
    for i in dashboard_config :
36
        app_conf[i] = dashboard_config[i]
37

    
38
    app = make_base_app(global_conf, full_stack=True, **app_conf)
39

    
40
    # Wrap your base TurboGears 2 application with custom middleware here
41
    
42
    return app