-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwsgi.py
36 lines (29 loc) · 978 Bytes
/
wsgi.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from werkzeug.wsgi import peek_path_info
from werkzeug.wsgi import DispatcherMiddleware
from capuchin import config as capuchin_config
from capuchin.app import Capuchin
from admin.app import CapuchinAdmin
from gevent import monkey
import logging
monkey.patch_all()
def create_capuchin_app():
logging.info("Initializing Capuchin")
def app(env, start_response):
_app = Capuchin()
if peek_path_info(env) == "healthcheck":
_app.config['SERVER_NAME'] = None
else:
_app.config['SERVER_NAME'] = capuchin_config.SERVER_NAME
return _app(env, start_response)
logging.info("Capuchin Running")
return app
def create_admin_app():
logging.info("Initializing Admin")
def app(env, start_response):
_app = CapuchinAdmin()
return _app(env, start_response)
logging.info("Admin Running")
return app
app = DispatcherMiddleware(create_capuchin_app(), {
'/admin': create_admin_app()
})