Jinja2 syntax equivalent to Django's URL name and static

  • Posted on: 4 April 2015
  • By: oon
Django's template URL name like for Jinja2

(after start using Jinja2 on Django)

I need to use Django syntax {% url %} in Jinja2, here's my reference [1].

{{ url('index', args=[variable]) }}

And Django syntax {% static %} also similar.

{{ static('path') }}

hope it helps!

[1]https://medium.com/@samuh/using-jinja2-with-django-1-8-onwards-9c58fe1204dc

 

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
By submitting this form, you accept the Mollom privacy policy.