diff options
| author | Claude Paroz <claude@2xlibre.net> | 2015-10-23 21:02:34 +0200 |
|---|---|---|
| committer | Claude Paroz <claude@2xlibre.net> | 2015-10-29 20:12:38 +0100 |
| commit | 7d81ee6efc385f7d4c1218639e4102c64495ba0f (patch) | |
| tree | 1ad9200f0775f223cff67b770dbda1f929e516d3 /docs | |
| parent | 9dcfecb7c6c8285630ad271888a9ec4ba9140e3a (diff) | |
Fixed #16734 -- Set script prefix even outside of requests
Thanks Tim Graham for the review.
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ref/applications.txt | 8 | ||||
| -rw-r--r-- | docs/ref/settings.txt | 9 | ||||
| -rw-r--r-- | docs/releases/1.10.txt | 5 |
3 files changed, 19 insertions, 3 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 diff --git a/docs/releases/1.10.txt b/docs/releases/1.10.txt index b291dcfd41..bea1dc10d1 100644 --- a/docs/releases/1.10.txt +++ b/docs/releases/1.10.txt @@ -209,7 +209,10 @@ Tests URLs ^^^^ -* ... +* An addition in :func:`django.setup()` allows URL resolving that happens + outside of the request/response cycle (e.g. in management commands and + standalone scripts) to take :setting:`FORCE_SCRIPT_NAME` into account when it + is set. Validators ^^^^^^^^^^ |
