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

Django परिचय

Django एक helper है जो आपके लिए बहुत सारा boring, repetitive काम कर देता है ताकि आप एक website तेज़ी से बना सकें।

Django क्या है?

Django एक high-level Python web framework है जो आपको websites बनाने देता है Python code लिखकर, बजाय इसके कि आप URL routing, database access, और forms जैसी common features को शुरू से फिर से बनाएं।

Note: Framework का मतलब है Django आपको एक web application का skeleton देता है; आप specific logic भरते हैं।

उदाहरण: What Is Django?

A Django view is just a Python function that takes a request and returns a response — this is a complete, working page in four lines.

markup
from django.http import HttpResponse

def home(request):
    return HttpResponse("Hello from Django!")
{# 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. #}

Django से आप क्या बना सकते हैं

Django कई तरह की sites बनाने के लिए उपयोग होता है: blogs, e-commerce stores, social networks, और internal admin tools, क्योंकि यह हर website को चाहिए वाले common parts handle करता है।

Note: वही framework जो एक छोटा blog चलाता है, एक बड़े social platform तक भी scale हो सकता है।

उदाहरण: What You Can Build With Django

The same view-returns-a-response pattern that builds this tiny blog page scales up to e-commerce stores, social feeds, and admin dashboards — Django doesn't care what the content is.

markup
from django.http import HttpResponse

def blog_home(request):
    posts = ["Welcome to my blog", "Django is fun", "Learning MVT"]
    return HttpResponse("<br>".join(posts))
{# 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. #}

Django vs Raw Python से Web Development

Django के बिना आपको manually HTTP requests parse करना, अपना खुद का URL router बनाना, और हर database query के लिए raw SQL लिखना पड़ता; Django यह सब आपको ready-to-use देता है।

Warning: एक framework पूरी तरह skip करना possible है लेकिन इसका मतलब है हर project में basic plumbing फिर से बनाना।

उदाहरण: Django vs Writing Raw Python for the Web

path() parses the URL and converts <int:article_id> straight into a Python int argument for your view — without Django you'd hand-write regex parsing and type conversion yourself.

markup
from django.urls import path
from . import views

urlpatterns = [
    path('articles/<int:article_id>/', views.article_detail),
]
{# 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. #}
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 एक programming language है, Python web framework नहीं।
  2. यह उम्मीद करना कि Django बिना Python पहले से install किए काम करेगा।
  3. Django (backend framework) को एक frontend JavaScript framework जैसे React के साथ confuse करना।
चैप्टर सारांश
  • Django एक free, open-source web framework है जो Python में लिखा गया है।
  • यह URLs, databases, templates, और admin panels के लिए ready-made tools देता है।
  • Django "batteries included" philosophy follow करता है, इसलिए ज़्यादातर common features built in हैं।
  • Instagram और Pinterest जैसी companies ने बड़ी websites बनाने के लिए Django उपयोग किया है।

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.