Django get url path without using "request.path"

I am creating a 404.html page in django that will be called when I bring up "Http404"

I don't know if 404.html will be passed a RequestContext object, but I can generate the requested url without using the request variable

I tried "request.path" and "request.get_full_path" but they don't work for me.

Any help would be appreciated.

+3


source to share


1 answer


The 404 template will render using the request context (as opposed to the server 500 error template).

Make sure the context processor django.core.context_processors.request

is in tune TEMPLATE_CONTEXT_PROCESSORS

. Please note that it is not enabled by default.



Once you've done that, the methods you mention how get_full_path

should work.

+6


source







All Articles