Subjects

All subjects Django Java Python React Spring Boot JavaScript PHP
Sign Up Free
Question 1 of 10 · Django Deployment & DevOps
Interview question

Why can't you use Django's runserver in production, and what should you use instead? प्रोडक्शन में Django के runserver का उपयोग क्यों नहीं कर सकते, और इसके बजाय क्या उपयोग करना चाहिए?

Answer

Django's development server (manage.py runserver) is explicitly single-threaded by default, unoptimized for performance, and lacks the security hardening, connection handling, and process management needed to serve real traffic — the Django documentation itself warns it must never be used in production.

Production deployments use a dedicated WSGI application server such as Gunicorn or uWSGI to run the Django application with multiple worker processes handling requests concurrently, typically placed behind a reverse proxy like Nginx that handles TLS termination, serves static files efficiently, and buffers slow client connections before they reach the application workers.

gunicorn myproject.wsgi:application --workers 4 --bind 0.0.0.0:8000

Django का डेवलपमेंट सर्वर (manage.py runserver) डिफ़ॉल्ट रूप से स्पष्ट रूप से सिंगल-थ्रेडेड है, परफॉर्मेंस के लिए अनुकूलित नहीं है, और इसमें वास्तविक ट्रैफिक की सेवा के लिए आवश्यक सुरक्षा सख्तीकरण की कमी है — Django दस्तावेज़ीकरण स्वयं चेतावनी देता है कि इसे प्रोडक्शन में कभी उपयोग नहीं किया जाना चाहिए।

प्रोडक्शन डिप्लॉयमेंट्स Gunicorn या uWSGI जैसे समर्पित WSGI एप्लिकेशन सर्वर का उपयोग करते हैं, जो आमतौर पर Nginx जैसे रिवर्स प्रॉक्सी के पीछे रखे जाते हैं।

gunicorn myproject.wsgi:application --workers 4 --bind 0.0.0.0:8000

Was this answer clear?