Is there a way to have something similar to Djangos {{ MEDIA_URL }}
tag in a Flask application?
Originally I simply wanted to use the static_url_path
option for this, but Werkzeug won't create url route for paths that doesn't start with '/'. This seems reasonable enough when I thought about it a bit more.
The second option, that does work, but which I dislike, is to simply parse a MEDIA_URL
variable to every single render_template
. I would like my solution to be a bit more automatic, if that's possible.
Is there a way to inject a variable into every single jinja2 template in advance or do I have to live with either parsing my MEDIA_URL
to very template or hardcode the img, css and javascript paths into my templates?