INSTALLED_APPS में Apps Register करना
INSTALLED_APPS = [
'django.contrib.admin',
# ... built-in apps
'app_name',
]
INSTALLED_APPS Setting
settings.py में INSTALLED_APPS नाम की एक Python list होती है। यह Django की built-in apps (admin, auth, sessions) से शुरू होती है और यहीं आप हर app जोड़ते हैं जो आप बनाते या install करते हैं।
उदाहरण: The INSTALLED_APPS Setting
settings.py contains a Python list called INSTALLED_APPS. It starts with Django's built-in apps (admin, auth, sessions) and is where you add every app you create or install.
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.sessions',
'blog',
]
{# Django-only code -- models.py/views.py/urls.py/settings.py
snippets, or template markup using Django template tags/variables
-- can't run standalone via Judge0 or the browser preview, since
it needs a real Django project. Only this course's pure-Python
examples (example_lang == 'python', no Django imports) are
actually runnable, so those still get the button below. #}
Short Name vs AppConfig Path
आप एक app को इसके short package name (blog) से या सीधे इसके AppConfig class ('blog.apps.BlogConfig') को point करके register कर सकते हैं। दोनों identically काम करते हैं; explicit path उपयोगी है जब एक app custom AppConfig behavior define करे।
उदाहरण: Short Name vs AppConfig Path
You can register an app by its short package name (blog) or by pointing directly at its AppConfig class ('blog.apps.BlogConfig'). Both work identically; the explicit path is useful when an app defines custom AppConfig behavior.
INSTALLED_APPS = [
# ...
'blog.apps.BlogConfig',
]
{# Django-only code -- models.py/views.py/urls.py/settings.py
snippets, or template markup using Django template tags/variables
-- can't run standalone via Judge0 or the browser preview, since
it needs a real Django project. Only this course's pure-Python
examples (example_lang == 'python', no Django imports) are
actually runnable, so those still get the button below. #}
Registration क्यों मायने रखता है
सिर्फ INSTALLED_APPS में listed apps के ही models makemigrations द्वारा discover होते हैं, admin.py load होता है, और templates/static folders Django के template और staticfiles finders द्वारा search होते हैं।
उदाहरण: Why Registration Matters
Only apps listed in INSTALLED_APPS get their models discovered by makemigrations, their admin.py loaded, and their templates/static folders searched by Django's template and staticfiles finders.
python manage.py makemigrations
# 'No changes detected' if the app isn't in INSTALLED_APPS yet
⚠️ Run this in your own terminal or Node.js environment.
- startapp से एक app बनाना लेकिन इसे कभी INSTALLED_APPS में न जोड़ना, इसलिए इसके models कभी migrate नहीं होते।
- गलत dotted path जोड़ना (जैसे 'blog.apps' बजाय 'blog.apps.BlogConfig' या सिर्फ blog)।
- एक custom app को Django की built-in apps से पहले इस तरह रखना जो template या static file overriding order को तोड़ दे।
- settings.py में INSTALLED_APPS हर app की list है जो Django load करेगा।
- Short form (blog) और AppConfig dotted path ('blog.apps.BlogConfig') दोनों entries के रूप में काम करते हैं।
- एक app के models, admin, और template tags Django के लिए invisible हैं जब तक यह इस list में दिखाई न दे।
Chapter Quiz — Complete all 10 topics to unlock
0/10 topics done
Complete these topics first: