mirror of
https://github.com/django/django.git
synced 2025-06-05 03:29:12 +00:00
Refs #35591 -- Removed hardcoded "stable" version in runserver warning.
This commit is contained in:
parent
f16a9a556f
commit
f883bef054
@ -11,6 +11,7 @@ from django.core.servers.basehttp import WSGIServer, get_internal_wsgi_applicati
|
|||||||
from django.db import connections
|
from django.db import connections
|
||||||
from django.utils import autoreload
|
from django.utils import autoreload
|
||||||
from django.utils.regex_helper import _lazy_re_compile
|
from django.utils.regex_helper import _lazy_re_compile
|
||||||
|
from django.utils.version import get_docs_version
|
||||||
|
|
||||||
naiveip_re = _lazy_re_compile(
|
naiveip_re = _lazy_re_compile(
|
||||||
r"""^(?:
|
r"""^(?:
|
||||||
@ -188,12 +189,14 @@ class Command(BaseCommand):
|
|||||||
f"Quit the server with {quit_command}.",
|
f"Quit the server with {quit_command}.",
|
||||||
file=self.stdout,
|
file=self.stdout,
|
||||||
)
|
)
|
||||||
|
docs_version = get_docs_version()
|
||||||
if os.environ.get("HIDE_PRODUCTION_WARNING") != "true":
|
if os.environ.get("HIDE_PRODUCTION_WARNING") != "true":
|
||||||
self.stdout.write(
|
self.stdout.write(
|
||||||
self.style.WARNING(
|
self.style.WARNING(
|
||||||
"WARNING: This is a development server. Do not use it in a "
|
"WARNING: This is a development server. Do not use it in a "
|
||||||
"production setting. Use a production WSGI or ASGI server "
|
"production setting. Use a production WSGI or ASGI server "
|
||||||
"instead.\nFor more information on production servers see: "
|
"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/"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -135,7 +135,7 @@ You'll see the following output on the command line:
|
|||||||
Quit the server with CONTROL-C.
|
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.
|
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::
|
.. note::
|
||||||
Ignore the warning about unapplied database migrations for now; we'll deal
|
Ignore the warning about unapplied database migrations for now; we'll deal
|
||||||
|
@ -957,7 +957,7 @@ suitable for production:
|
|||||||
.. code-block:: text
|
.. 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.
|
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.
|
Set this environment variable to ``"true"`` to hide this warning.
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ from django.db.migrations.recorder import MigrationRecorder
|
|||||||
from django.test import LiveServerTestCase, SimpleTestCase, TestCase, override_settings
|
from django.test import LiveServerTestCase, SimpleTestCase, TestCase, override_settings
|
||||||
from django.test.utils import captured_stderr, captured_stdout
|
from django.test.utils import captured_stderr, captured_stdout
|
||||||
from django.urls import path
|
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 django.views.static import serve
|
||||||
|
|
||||||
from . import urls
|
from . import urls
|
||||||
@ -1597,11 +1597,13 @@ class ManageRunserver(SimpleTestCase):
|
|||||||
"Starting development server at http://0.0.0.0:8000/",
|
"Starting development server at http://0.0.0.0:8000/",
|
||||||
self.output.getvalue(),
|
self.output.getvalue(),
|
||||||
)
|
)
|
||||||
|
docs_version = get_docs_version()
|
||||||
self.assertIn(
|
self.assertIn(
|
||||||
"WARNING: This is a development server. Do not use it in a "
|
"WARNING: This is a development server. Do not use it in a "
|
||||||
"production setting. Use a production WSGI or ASGI server instead."
|
"production setting. Use a production WSGI or ASGI server instead."
|
||||||
"\nFor more information on production servers see: "
|
"\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(),
|
self.output.getvalue(),
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1613,11 +1615,13 @@ class ManageRunserver(SimpleTestCase):
|
|||||||
"Starting development server at http://127.0.0.1:14437/",
|
"Starting development server at http://127.0.0.1:14437/",
|
||||||
self.output.getvalue(),
|
self.output.getvalue(),
|
||||||
)
|
)
|
||||||
|
docs_version = get_docs_version()
|
||||||
self.assertIn(
|
self.assertIn(
|
||||||
"WARNING: This is a development server. Do not use it in a "
|
"WARNING: This is a development server. Do not use it in a "
|
||||||
"production setting. Use a production WSGI or ASGI server instead."
|
"production setting. Use a production WSGI or ASGI server instead."
|
||||||
"\nFor more information on production servers see: "
|
"\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(),
|
self.output.getvalue(),
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1630,11 +1634,13 @@ class ManageRunserver(SimpleTestCase):
|
|||||||
"Starting development server at http://0.0.0.0:8000/",
|
"Starting development server at http://0.0.0.0:8000/",
|
||||||
self.output.getvalue(),
|
self.output.getvalue(),
|
||||||
)
|
)
|
||||||
|
docs_version = get_docs_version()
|
||||||
self.assertNotIn(
|
self.assertNotIn(
|
||||||
"WARNING: This is a development server. Do not use it in a "
|
"WARNING: This is a development server. Do not use it in a "
|
||||||
"production setting. Use a production WSGI or ASGI server instead."
|
"production setting. Use a production WSGI or ASGI server instead."
|
||||||
"\nFor more information on production servers see: "
|
"\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(),
|
self.output.getvalue(),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user