MCPcopy Create free account
hub / github.com/alphagov/notifications-api / create_app

Function create_app

app/__init__.py:162–198  ·  view source on GitHub ↗
(application)

Source from the content-addressed store, hash-verified

160def create_app(application: Flask) -> Flask:
161 from app.config import Config, configs
162
163 application.json_provider_class = FlaskRelaxedContainerJSONProvider
164
165 notify_environment = os.environ["NOTIFY_ENVIRONMENT"]
166
167 if notify_environment in configs:
168 application.config.from_object(configs[notify_environment])
169 else:
170 application.config.from_object(Config)
171
172 application.config["NOTIFY_APP_NAME"] = application.name
173 init_app(application)
174
175 request_helper.init_app(application)
176 db.init_app(application)
177 migrate.init_app(application, db=db)
178 ma.init_app(application)
179 utils_logging.init_app(application)
180
181 notify_celery.init_app(application)
182 signing.init_app(application)
183 redis_store.init_app(application)
184
185 register_blueprint(application)
186 register_v2_blueprints(application)
187
188 # avoid circular imports by importing this file later
189 from app.commands import setup_commands
190
191 setup_commands(application)
192
193 # set up sqlalchemy events
194 setup_sqlalchemy_events(application)
195
196 return application
197
198
199def reset_memos():
200 """
201 Reset all memos registered in memo_resetters

Callers 3

application.pyFile · 0.90
run_celery.pyFile · 0.90
notify_apiFunction · 0.90

Calls 5

setup_commandsFunction · 0.90
init_appFunction · 0.85
register_blueprintFunction · 0.85
register_v2_blueprintsFunction · 0.85
setup_sqlalchemy_eventsFunction · 0.85

Tested by 1

notify_apiFunction · 0.72