Search code examples
pythondjangoserverbackenduwsgi

Why not use "runserver" for production at Django?


Everywhere i see that uWSGI and Gunicorn are recommended for production mode from everyone. However, there is a lot more suffering to operate with it, the python manage.py runserver is more faster, simpler, and the logging is also more visible if something goes wrong. Still, why not recommend the "python manage.py runserver" command for live production?


Solution

  • The runserver management command is optimized for different things from a web-server. Here are some things it does that are great for local development but would add unnecessary overhead in a production environment (source):

    • The development server automatically reloads Python code for each request, as needed
    • When you start the server, and each time you change Python code while the server is running, the system check framework will check your entire Django project for some common errors
    • Serves static files if the staticfiles contrib app is enabled (in a manner the docs describe as "grossly inefficient and probably insecure")

    Meanwhile, production web-servers are designed to handle massively parallel workloads and are also under much higher security standards as they are the entry-point for all port 80/443 traffic to the server