summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2024-08-11 13:08:00 +0200
committerSarah Boyce <42296566+sarahboyce@users.noreply.github.com>2024-08-12 10:57:02 +0200
commitf883bef05457a5a49eb31109429fc01737f82532 (patch)
tree848716e2567f1d10c7a2f6c2367871579fb25c92
parentf16a9a556fb4225f9094048614f4fcec3db7e067 (diff)
Refs #35591 -- Removed hardcoded "stable" version in runserver warning.
-rw-r--r--django/core/management/commands/runserver.py5
-rw-r--r--docs/intro/tutorial01.txt2
-rw-r--r--docs/ref/django-admin.txt2
-rw-r--r--tests/admin_scripts/tests.py14
4 files changed, 16 insertions, 7 deletions
diff --git a/django/core/management/commands/runserver.py b/django/core/management/commands/runserver.py
index 3795809a12..2c8e445de8 100644
--- a/django/core/management/commands/runserver.py
+++ b/django/core/management/commands/runserver.py
@@ -11,6 +11,7 @@ from django.core.servers.basehttp import WSGIServer, get_internal_wsgi_applicati
from django.db import connections
from django.utils import autoreload
from django.utils.regex_helper import _lazy_re_compile
+from django.utils.version import get_docs_version
naiveip_re = _lazy_re_compile(
r"""^(?:
@@ -188,12 +189,14 @@ class Command(BaseCommand):
f"Quit the server with {quit_command}.",
file=self.stdout,
)
+ docs_version = get_docs_version()
if os.environ.get("HIDE_PRODUCTION_WARNING") != "true":
self.stdout.write(
self.style.WARNING(
"WARNING: This is a development server. Do not use it in a "
"production setting. Use a production WSGI or ASGI server "
"instead.\nFor more information on production servers see: "
- "https://docs.djangoproject.com/en/stable/howto/deployment/"
+ f"https://docs.djangoproject.com/en/{docs_version}/howto/"
+ "deployment/"
)
)
diff --git a/docs/intro/tutorial01.txt b/docs/intro/tutorial01.txt
index 0536eca2f7..3f89220949 100644
--- a/docs/intro/tutorial01.txt
+++ b/docs/intro/tutorial01.txt
@@ -135,7 +135,7 @@ You'll see the following output on the command line:
Quit the server with CONTROL-C.
WARNING: This is a development server. Do not use it in a production setting. Use a production WSGI or ASGI server instead.
- For more information on production servers see: https://docs.djangoproject.com/en/stable/howto/deployment/
+ For more information on production servers see: https://docs.djangoproject.com/en/|version|/howto/deployment/
.. note::
Ignore the warning about unapplied database migrations for now; we'll deal
diff --git a/docs/ref/django-admin.txt b/docs/ref/django-admin.txt
index 52eaaa331b..f2c9e1bdc3 100644
--- a/docs/ref/django-admin.txt
+++ b/docs/ref/django-admin.txt
@@ -957,7 +957,7 @@ suitable for production:
.. code-block:: text
WARNING: This is a development server. Do not use it in a production setting. Use a production WSGI or ASGI server instead.
- For more information on production servers see: https://docs.djangoproject.com/en/stable/howto/deployment/
+ For more information on production servers see: https://docs.djangoproject.com/en/|version|/howto/deployment/
Set this environment variable to ``"true"`` to hide this warning.
diff --git a/tests/admin_scripts/tests.py b/tests/admin_scripts/tests.py
index 67362460a9..5ee3eeb803 100644
--- a/tests/admin_scripts/tests.py
+++ b/tests/admin_scripts/tests.py
@@ -33,7 +33,7 @@ from django.db.migrations.recorder import MigrationRecorder
from django.test import LiveServerTestCase, SimpleTestCase, TestCase, override_settings
from django.test.utils import captured_stderr, captured_stdout
from django.urls import path
-from django.utils.version import PY313
+from django.utils.version import PY313, get_docs_version
from django.views.static import serve
from . import urls
@@ -1597,11 +1597,13 @@ class ManageRunserver(SimpleTestCase):
"Starting development server at http://0.0.0.0:8000/",
self.output.getvalue(),
)
+ docs_version = get_docs_version()
self.assertIn(
"WARNING: This is a development server. Do not use it in a "
"production setting. Use a production WSGI or ASGI server instead."
"\nFor more information on production servers see: "
- "https://docs.djangoproject.com/en/stable/howto/deployment/",
+ f"https://docs.djangoproject.com/en/{docs_version}/howto/"
+ "deployment/",
self.output.getvalue(),
)
@@ -1613,11 +1615,13 @@ class ManageRunserver(SimpleTestCase):
"Starting development server at http://127.0.0.1:14437/",
self.output.getvalue(),
)
+ docs_version = get_docs_version()
self.assertIn(
"WARNING: This is a development server. Do not use it in a "
"production setting. Use a production WSGI or ASGI server instead."
"\nFor more information on production servers see: "
- "https://docs.djangoproject.com/en/stable/howto/deployment/",
+ f"https://docs.djangoproject.com/en/{docs_version}/howto/"
+ "deployment/",
self.output.getvalue(),
)
@@ -1630,11 +1634,13 @@ class ManageRunserver(SimpleTestCase):
"Starting development server at http://0.0.0.0:8000/",
self.output.getvalue(),
)
+ docs_version = get_docs_version()
self.assertNotIn(
"WARNING: This is a development server. Do not use it in a "
"production setting. Use a production WSGI or ASGI server instead."
"\nFor more information on production servers see: "
- "https://docs.djangoproject.com/en/stable/howto/deployment/",
+ f"https://docs.djangoproject.com/en/{docs_version}/howto/"
+ "deployment/",
self.output.getvalue(),
)