-
Notifications
You must be signed in to change notification settings - Fork 4
/
__init__.py
48 lines (35 loc) · 1.06 KB
/
__init__.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
37
38
39
40
41
42
43
44
45
46
47
48
"""
Top-level Flask application for HXL Proxy
David Megginson
January 2015
License: Public Domain
Documentation: http://hxlstandard.org
"""
import logging, os
import requests_cache
from flask import Flask, g, request
from flask_caching import Cache
import werkzeug.datastructures
from . import reverse_proxied
__version__="1.20"
"""Module version number
See https://www.python.org/dev/peps/pep-0396/
"""
# Main application object
app = Flask(__name__)
# Disable default logging (we'll add any log handlers explicitly in deployment)
app.logger.addHandler(logging.NullHandler)
# Handle subpaths
app.wsgi_app = reverse_proxied.ReverseProxied(app.wsgi_app)
# Config
app.config.from_object('hxl_proxy.default_config')
if os.environ.get('HXL_PROXY_CONFIG'):
app.config.from_envvar('HXL_PROXY_CONFIG')
app.jinja_env.trim_blocks = True
app.jinja_env.lstrip_blocks = True
# Set up output cache
cache = Cache(app, config=app.config.get('CACHE_CONFIG'))
# (Setting up requests cache dynamically in controllers.py)
# Needed to register annotations
import hxl_proxy.controllers
# end