import logging
from service import logging_config

logging_config.setup_logging()
LOGGER = logging.getLogger(__name__)

# Application event handlers for when the server is run by gunicorn


def on_starting(server):
    LOGGER.info('Starting the server')


def on_reload(server):
    LOGGER.info('Reloading the server')


def when_ready(server):
    LOGGER.info('Server is ready')


def on_exit(server):
    LOGGER.info('Stopping the server')
예제 #2
0
    price_text = app.config['TITLE_REGISTER_SUMMARY_PRICE_TEXT'].format(price)

    app.config.update({'TITLE_REGISTER_SUMMARY_PRICE': price})
    app.config.update({'TITLE_REGISTER_SUMMARY_PRICE_TEXT': price_text})


ui.register_assets(app)  # type: ignore

for (filter_name, filter_method
     ) in template_filters.get_all_filters().items():  # type: ignore
    app.jinja_env.filters[filter_name] = filter_method

GOOGLE_ANALYTICS_API_KEY = app.config['GOOGLE_ANALYTICS_API_KEY']
GOVUK_FEEDBACK_URL = app.config['GOVUK_FEEDBACK_URL']
JUNCTION = app.config['JUNCTION']


@app.context_processor
def inject_global_config():
    return dict(google_api_key=GOOGLE_ANALYTICS_API_KEY,
                govuk_feedback_url=GOVUK_FEEDBACK_URL,
                junction=JUNCTION)


logging_config.setup_logging()  # type: ignore
if app.config['DEBUG'] is False:
    # Retain traceback when DEBUG = True
    error_handler.setup_errors(app)  # type: ignore
error_handler.setup_errors(app)  # type: ignore