Disable runserver warning in Django 5.2
Django 5.2 added a new warning that shows up when you start your development server with python manage.py runserver
:
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/5.2/howto/deployment/
Here is how it looks like in the terminal:
The warning is helpful for newcomers because Django’s development server is neither secure nor performant enough to be exposed to the internet.
However, if you’ve already configured your production environment with a proper WSGI/ASGI server, seeing the warning every time your development server reloads becomes tedious.
The Fix
Luckily, there is a way to disable it with the DJANGO_RUNSERVER_HIDE_WARNING environment variable. DJANGO_RUNSERVER_HIDE_WARNING=true python manage.py runserver
:
If you are using django-environ or any other tool that loads environment variables from a .env
file, you can put the DJANGO_RUNSERVER_HIDE_WARNING=true
line to it, and the warning will no longer show up. 🎉