Opened 3 months ago

Closed 2 months ago

Last modified 2 months ago

#35591 closed Cleanup/optimization (fixed)

Add warning to runserver that it should not be used for production

Reported by: Andy Miller Owned by: Andy Miller
Component: Core (Management commands) Version: dev
Severity: Normal Keywords:
Cc: Andy Miller, Ülgen Sarıkavak Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

As per this discussion on the forum, I think adding a warning to the start of runserver would be valuable to those new to Django and a healthy reminder to those coming back to Django.

The wording of the warning is:

WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.

For more information on production servers see the documentation: https://docs.djangoproject.com/en/5.0/howto/deployment/

Additionally a flag should be added to optionally hide the warning. --hide-unsuitable-for-production was a suggestion.

Finally the following 2 pages of the documentation should have add some wording to highlight that a deployed project should not use runserver.

Change History (16)

comment:1 by Sarah Boyce, 3 months ago

Triage Stage: UnreviewedAccepted
Type: UncategorizedCleanup/optimization

I think it's worth highlighting that it does say "development server":

Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.

We also have a warning in the runserver docs and a warning in the tutorial (note that the tutorial runserver output would need to be updated if we make a change here).

So I think this is not that we don't have this already but a request to make this information more prominent

comment:2 by Suraj Bahuguna, 3 months ago

Summary: Add warning to runserver that is should not be used for productionAdd warning to runserver that it should not be used for production

comment:3 by Suraj Bahuguna, 3 months ago

Owner: set to Suraj Bahuguna
Status: newassigned

This will be the new output by default. Warning can be disabled by using --hide-unsuitable-for-production flag

Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.

WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
For more information on production servers see the documentation: https://docs.djangoproject.com/en/5.0/howto/deployment/

comment:4 by Ülgen Sarıkavak, 3 months ago

Cc: Ülgen Sarıkavak added

comment:5 by Andy Miller, 2 months ago

Task list:

comment:6 by Andy Miller, 2 months ago

Owner: changed from Suraj Bahuguna to Andy Miller

comment:7 by Andy Miller, 2 months ago

Has patch: set

comment:8 by Sarah Boyce, 2 months ago

Patch needs improvement: set

comment:9 by Andy Miller, 2 months ago

Patch needs improvement: unset

Updated the PR.

comment:10 by Sarah Boyce <42296566+sarahboyce@…>, 2 months ago

In cec62fb9:

Refs #35591 -- Emphasized that runserver is not suitable for production.

comment:11 by Sarah Boyce <42296566+sarahboyce@…>, 2 months ago

In 73fcb14:

[5.1.x] Refs #35591 -- Emphasized that runserver is not suitable for production.

Backport of cec62fb99e8ff63f30c7871a048ab15081142668 from main.

comment:12 by Sarah Boyce, 2 months ago

Patch needs improvement: set

comment:13 by Andy Miller, 2 months ago

Patch needs improvement: unset

comment:14 by Sarah Boyce, 2 months ago

Triage Stage: AcceptedReady for checkin

comment:15 by Sarah Boyce <42296566+sarahboyce@…>, 2 months ago

Resolution: fixed
Status: assignedclosed

In 69aa13f:

Fixed #35591 -- Added unsuitable for production console warning to runserver.

comment:16 by Sarah Boyce <42296566+sarahboyce@…>, 2 months ago

In f883bef0:

Refs #35591 -- Removed hardcoded "stable" version in runserver warning.

Note: See TracTickets for help on using tickets.
Back to Top