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
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