Django परिचय
In this page:
Django क्या है?
Django एक high-level Python web framework है जो आपको websites बनाने देता है Python code लिखकर, बजाय इसके कि आप URL routing, database access, और forms जैसी common features को शुरू से फिर से बनाएं।
उदाहरण: 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.
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 करता है।
उदाहरण: 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.
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 देता है।
उदाहरण: 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.
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. #}
- यह मान लेना कि Django एक programming language है, Python web framework नहीं।
- यह उम्मीद करना कि Django बिना Python पहले से install किए काम करेगा।
- 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 उपयोग किया है।
Chapter Quiz — Complete all 9 topics to unlock
0/9 topics done
Complete these topics first: