Let’s say you want to have some variables available in all templates by default. There’s how you do it:
@app.context_processor
def inject_global_vars():
return {'x': 1}
Now x is available everywhere. You can see it in action here
How to define global template variables in Flask
Let’s say you want to have some variables available in all templates by default. There’s how you do it:
@app.context_processor
def inject_global_vars():
return {'x': 1}
Now x is available everywhere. You can see it in action here