__init__.py

About this file

The init.py file is used to initialize all python packages. It imports selected Classes, functions, etc into the package level. Functions are defined to set up the flask application context and error handlers.
Also, at the package level subpackages/modules are made available. Blueprints are registered in this file.

Code Check Report


app/__init__.py:27:1: F401 'app.constants.OPENRECORDS_DL_EMAIL' imported but unused
app/__init__.py:81:1: W293 blank line contains whitespace
                        

Documentation drawn from source code


create_app(config_name='default'):

Set up the Flask Application context.

:param config_name: Configuration for specific application context.

:return: Flask application
mail_handler.setFormatter(Formatter(
Message Type: %(levelname)s
Location: %(pathname)s:%(lineno)d
Module: %(module)s
Function: %(funcName)s
Time: %(asctime)s

Message:
%(message)s

bad_request(e):

forbidden(e):

page_not_found(e):

internal_server_error(e):
app.logger.error("""Request: {method} {path}
IP: {ip}
User: {user}
Agent: {agent_platform} | {agent_browser} {agent_browser_version}
Raw Agent: {agent}
Error ID: {error_id}

maintenance(e):

check_maintenance_mode():

add_session_config():
Add current_app.permanent_session_lifetime converted to milliseconds
to context. The config variable PERMANENT_SESSION_LIFETIME is not
used because it could be either a timedelta object or an integer
representing seconds.

add_debug():
Add current_app.debug to context.

Source code