From bdf59bff657975e577b86b194b39ec2f77983d2b Mon Sep 17 00:00:00 2001 From: Sarah Boyce <42296566+sarahboyce@users.noreply.github.com> Date: Thu, 6 Apr 2023 13:01:26 +0200 Subject: [PATCH] Refs #34028 -- Doc'd that get_script_prefix() cannot be used outside of the request-response cycle. --- docs/ref/urlresolvers.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/ref/urlresolvers.txt b/docs/ref/urlresolvers.txt index 89564279a1..eb0b991f1b 100644 --- a/docs/ref/urlresolvers.txt +++ b/docs/ref/urlresolvers.txt @@ -236,3 +236,8 @@ its web server (normally, :func:`~django.urls.reverse` takes care of this for you). In that case, you can call ``get_script_prefix()``, which will return the script prefix portion of the URL for your Django project. If your Django project is at the root of its web server, this is always ``"/"``. + +.. warning:: + + This function **cannot** be used outside of the request-response cycle + since it relies on values initialized during that cycle.