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.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments