अपना पहला Django Project बनाना
In this page:
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.
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.
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.
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.
python manage.py help
⚠️ Run this in your own terminal or Node.js environment.
- "django-admin startproject" को एक ऐसे नाम के साथ run करना जो एक existing folder से match करे, जो conflicts का कारण बनता है।
- Current directory के अंदर project बनाते समय trailing dot भूल जाना, जो एक unwanted extra nested folder बनाता है।
- 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 है।
Chapter Quiz — Complete all 9 topics to unlock
0/9 topics done
Complete these topics first: