Is there a way to print the current URL in Jinja2/Flask?
E.g. if the current URL is http://www.domain.com/example/1/2
{{ request.path }}
works and prints /example/1/2
, but how to I get the full URL with http:// as well?
From the docs (here){{ request.url }}
should work, but it doesn't yield anything.
Thanks
UPDATE
Here are the render/context args from views.py:
class EventDetailView(EventObjectMixin, FormView): template_name = 'gig/public/about.html' context_object_name = 'event' form_class = EventPurchaseTicketForm def get_context_data(self, **kwargs): context = super(EventDetailView, self).get_context_data(**kwargs) ... return context
You can use {{ url_for(request.endpoint) }}
, it works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With