In Django, you can get the referer (referrer) using the "HTTP_REFERER" key from the "request.META" dictionary.

Here's an example:

def my_view(request):
    referer = request.META.get('HTTP_REFERER')
    # do something with the referer
    return HttpResponse('Hello World')

In the above example, the "my_view" function gets the referer from the "request.META" dictionary using the "HTTP_REFERER" key. The referer is then stored in the "referer" variable, which can be used to perform some action. Finally, the function returns an HTTP response with the text "Hello World"

get referer in django

原文地址: https://www.cveoy.top/t/topic/eGNh 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录