Is there a way to put breakpoints in a jinja template that is being rendered from flask ? Maybe something that can enable you do inspect the variables that are available to the template at various points in the template ? Ive seen a blog that says you can do it in django https://opensourcehacker.com/2013/05/16/putting-breakpoints-to-html-templates-in-python/ was hoping for something similar with flask.
Flask has app_context_processor
make variables available on templates:
Context processors run before the template is rendered and have the ability to inject new values into the template context.
class Letters():
A = 1
B = 2
@app.context_processor
def share_context():
return dict(Letters=Letters)
Now you can access this class
# index.html
{{ Letters.A }}
{% if Letters.B != 1 %}
...
{% endif %}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.