← Back to Django Course | Chapter 1: Django Fundamentals & Setup | Lesson 8 of 9

Development Server चलाना

Development server आपके अपने computer पर एक mini web server है जो आपको किसी और के देखने से पहले आपकी Django site preview करने देता है।
Syntax
markup
python manage.py runserver

python manage.py runserver port_number

Development Server Start करना

Project folder से "python manage.py runserver" run करना एक local web server start करता है, और Django वह address print करता है जहां आप अपनी site एक browser में देख सकते हैं।

उदाहरण: Starting the Development Server

Starts Django's built-in development server on the default port.

bash
python manage.py runserver

⚠️ Run this in your own terminal or Node.js environment.

एक अलग Port चुनना

runserver के बाद एक port number जोड़ना, जैसे "python manage.py runserver 8080", server को default 8000 के बजाय उस port पर start करता है।

उदाहरण: Choosing a Different Port

Starts the development server on port 8080 instead of the default.

bash
python manage.py runserver 8080

⚠️ Run this in your own terminal or Node.js environment.

Code Changes पर Auto-Reload

Development server आपकी Python files देखता है और जब भी आप कोई change save करते हैं अपने आप restart हो जाता है, इसलिए आपको शायद ही कभी इसे manually stop और start करना पड़ता है।

उदाहरण: Auto-Reload on Code Changes

StatReloader watches every .py file in the project; saving one prints this line and restarts the server for you automatically — no manual stop/start needed.

bash
python manage.py runserver
Watching for file changes with StatReloader

⚠️ Run this in your own terminal or Node.js environment.

Production में क्यों उपयोग न करें

Development server single-threaded है और असली traffic के नीचे security या performance के लिए optimized नहीं है, इसलिए production sites इसके बजाय Nginx के पीछे Gunicorn जैसे servers उपयोग करती हैं।

Warning: कभी भी "runserver" सीधे उपयोग करके एक live site deploy न करें — यह explicitly सिर्फ development के लिए है।

उदाहरण: Why Not to Use It in Production

This is the real command that replaces runserver in production — Gunicorn (usually paired with Nginx) is a production-grade WSGI server; runserver is single-threaded and refuses that role on purpose.

bash
pip install gunicorn
gunicorn mysite.wsgi:application

⚠️ Run this in your own terminal or Node.js environment.

Related Topics
{# common_mistakes/chapter_summary/browser_support: on Hindi pages the view already swaps in the hi_ translation fields (or blanks these out if untranslated), so this renders correctly for both languages without a lang_code check here. #}
आम गलतियां
  1. Server run करने से पहले migrations apply करना भूल जाना, जो पहले load पर database errors का कारण बनता है।
  2. Project folder के बाहर server run करना जहां manage.py मौजूद नहीं।
  3. Production में proper production web server के बजाय development server उपयोग करना।
चैप्टर सारांश
  • Command "python manage.py runserver" Django का built-in development server start करता है।
  • By default यह http://127.0.0.1:8000/ पर run होता है।
  • जब आप Python files में changes save करते हैं server auto-reload होता है।
  • यह सिर्फ local development के लिए है, कभी production traffic के लिए नहीं।

Login to run this code

C/C++/Java/PHP execution requires a free account. Your code is saved — you'll land right back in the editor after logging in.