summaryrefslogtreecommitdiff
path: root/docs/ref
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2015-10-23 21:02:34 +0200
committerClaude Paroz <claude@2xlibre.net>2015-10-29 20:12:38 +0100
commit7d81ee6efc385f7d4c1218639e4102c64495ba0f (patch)
tree1ad9200f0775f223cff67b770dbda1f929e516d3 /docs/ref
parent9dcfecb7c6c8285630ad271888a9ec4ba9140e3a (diff)
Fixed #16734 -- Set script prefix even outside of requests
Thanks Tim Graham for the review.
Diffstat (limited to 'docs/ref')
-rw-r--r--docs/ref/applications.txt8
-rw-r--r--docs/ref/settings.txt9
2 files changed, 15 insertions, 2 deletions
diff --git a/docs/ref/applications.txt b/docs/ref/applications.txt
index 498e10c954..ba0ddeb532 100644
--- a/docs/ref/applications.txt
+++ b/docs/ref/applications.txt
@@ -332,14 +332,20 @@ application registry.
.. currentmodule:: django
-.. function:: setup()
+.. function:: setup(set_script=True)
Configures Django by:
* Loading the settings.
* Setting up logging.
+ * If ``set_script`` is True, setting the URL resolver script prefix to
+ :setting:`FORCE_SCRIPT_NAME` if defined, or ``/`` otherwise.
* Initializing the application registry.
+ .. versionchanged:: 1.10
+
+ The ability to set the URL resolver script prefix is new.
+
This function is called automatically:
* When running an HTTP server via Django's WSGI support.
diff --git a/docs/ref/settings.txt b/docs/ref/settings.txt
index dba54e26b4..705cecbb57 100644
--- a/docs/ref/settings.txt
+++ b/docs/ref/settings.txt
@@ -1408,7 +1408,14 @@ Default: ``None``
If not ``None``, this will be used as the value of the ``SCRIPT_NAME``
environment variable in any HTTP request. This setting can be used to override
the server-provided value of ``SCRIPT_NAME``, which may be a rewritten version
-of the preferred value or not supplied at all.
+of the preferred value or not supplied at all. It is also used by
+:func:`django.setup()` to set the URL resolver script prefix outside of the
+request/response cycle (e.g. in management commands and standalone scripts) to
+generate correct URLs when ``SCRIPT_NAME`` is not ``/``.
+
+.. versionchanged:: 1.10
+
+ The setting's use in :func:`django.setup()` was added.
.. setting:: FORMAT_MODULE_PATH