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

अपना पहला Django Project बनाना

एक Django project शुरू करना ऐसा है जैसे Django आपके लिए सभी basic rooms पहले से जगह पर रखा एक empty घर बना दे, आपके decorate करने के लिए ready।
Syntax
markup
django-admin startproject project_name

एक नया Project बनाना

"django-admin startproject mysite" run करना "mysite" नाम का एक नया folder generate करता है जिसमें initial Django project files होती हैं, run करने के लिए ready।

उदाहरण: Creating a New Project

Scaffolds a new Django project named mysite with the default file structure.

bash
django-admin startproject mysite

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

Project Folder में Move करना

बनाने के बाद, आपको कोई भी दूसरा Django command run करने से पहले outer project folder में move करना होता है, क्योंकि manage.py वहीं रहता है।

उदाहरण: Moving Into the Project Folder

Changes into the newly created project directory.

bash
cd mysite

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

Generated Files List करना

Project folder के अंदर "ls" run करना manage.py और एक inner settings package दिखाता है, confirm करते हुए कि project scaffold सही से बना।

उदाहरण: Listing the Generated Files

Lists the files and folders generated by startproject.

bash
ls

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

manage.py क्या करता है

manage.py हर project के साथ auto-generate होने वाली एक command-line utility है; यह आपको server run करने, migrations apply करने, और लंबे Python commands type किए बिना app manage करने देता है।

उदाहरण: What manage.py Does

Running manage.py help lists every subcommand it provides — runserver, migrate, createsuperuser, startapp, and more — confirming exactly what the file can do.

bash
python manage.py help

⚠️ 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. "django-admin startproject" को एक ऐसे नाम के साथ run करना जो एक existing folder से match करे, जो conflicts का कारण बनता है।
  2. Current directory के अंदर project बनाते समय trailing dot भूल जाना, जो एक unwanted extra nested folder बनाता है।
  3. startproject run करने से पहले virtual environment activate न करना, जिससे files गलत interpreter के साथ tracked हो जाती हैं।
चैप्टर सारांश
  • "django-admin startproject" command एक नया Django project scaffold करता है।
  • एक project में एक settings.py, urls.py, और एक manage.py entry point होता है।
  • manage.py का उपयोग project-specific commands जैसे dev server run करने के लिए होता है।
  • Generated folder structure हर Django app का starting point है।

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.