I have the following structure for my flask application. When an invalid url comes in a 404 error is called, but my 404.html requires data from the context_processor but in the abort 404 the blueprint is None so context_processor is never called and 404.html is missing data.
How can I approach this differently?
init.py
def create_app(settings_overide=None):
app = factory.create_app(__name__, __path__, settings_overide)
if not app.debug:
app.errorhandler(404)(page_not_found)
return app
def page_not_found(e):
return render_template('404.html'), 404
processors.py
@blueprint.context_processor
def load_global_data():
return get_data()