Wie eine Anfrage Ihre View erreicht
WSGI, der URL-Resolver und der Weg zu Ihrem Code.
Wie eine Anfrage Ihre View erreicht ist eine kostenlose Django Academy-Lektion auf CoddyKit. Dies ist Lektion 1 von 4. Du kannst die komplette Lektion unten kostenlos lesen – dann übst du sie direkt im Browser mit einem integrierten Code-Editor und einem KI-Tutor rund um die Uhr. Sie ist Teil des Django Academy-Lernpfads, und dein Fortschritt wird über Web und CoddyKit-App synchronisiert. Der Django Academy-Kurs umfasst insgesamt 4 Lektionen.
Teile dieser Lektion wurden noch nicht übersetzt und werden auf Englisch angezeigt.
It Starts with a Click
Every Django page begins as an HTTP request. A browser asks for a URL, and Django's job is to answer with a response. 🌐
The Web Server Out Front
A web server like Nginx receives the raw request first. It handles networking, then hands the request off to Django to do the real work.
WSGI: The Handshake
WSGI is the standard interface between the web server and Django. It turns the incoming request into something your Python code can read.
The WSGI Application
Django ships a callable in wsgi.py. The server calls it for each request, and Django takes over from there to route and respond.
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()Middleware Runs First
Before your view, the request passes through middleware. Each layer can inspect or tweak the request, like adding security checks.
The URL Resolver
Django reads urls.py and matches the requested path against your patterns. The first pattern that matches wins the request.
urlpatterns = [
path('about/', views.about),
]Matching the Path
If the path is /about/, Django finds the matching pattern and notes which view should handle it. No match means a 404.
Calling Your View
Django calls your view function and passes it the request object. This is where your own code finally takes control.
def about(request):
return HttpResponse("Hi")The View Returns a Response
Your view must return an HttpResponse. Django takes that object and hands it back up the chain toward the browser.
Back Through Middleware
The response travels back through middleware in reverse order. Layers can add headers or compress content before it leaves.
Out to the Browser
The web server sends the finished response across the network. The browser renders it, completing one full request cycle. ✅
Quick Check
Which component matches the requested path to a view?
Recap: The Journey
A request flows from server to WSGI, through middleware, to the URL resolver, then your view, and back out as a response. That loop is Django. 🎉
Lerne Python mit einem KI-Tutor — kostenlos
Schreibe und führe echten Code in deinem Browser aus, bekomme sofortige Hilfe von einem 24/7 KI-Tutor und setze dein Lernen im Web oder in der App fort.
- Kurse
- 30
- Lektionen
- 120
Häufig gestellte Fragen
Ist die Lektion „Wie eine Anfrage Ihre View erreicht“ kostenlos?
Ja — der vollständige Text von „Wie eine Anfrage Ihre View erreicht“ ist hier im Web kostenlos zu lesen. Um sie interaktiv zu üben (integrierter Code-Editor und 24/7 KI-Tutor) und den Rest des Django Academy-Kurses freizuschalten, upgrade auf CoddyKit PRO. Der Django Academy-Kurs umfasst insgesamt 4 Lektionen.
Was lerne ich in „Wie eine Anfrage Ihre View erreicht“?
WSGI, der URL-Resolver und der Weg zu Ihrem Code. Du übst Django Academy mit praktischem Code, den du direkt im Browser ausführst, und ein 24/7 KI-Tutor beantwortet deine Fragen während du die Lektion bearbeitest.
Brauche ich Erfahrung, um Django Academy zu starten?
Keine Vorkenntnisse erforderlich. Django Academy auf CoddyKit ist für Anfänger bis fortgeschrittene Lernende strukturiert, sodass du hier starten oder von Anfang an beginnen und in deinem eigenen Tempo voranschreiten kannst. Dies ist Lektion 1 von 4.
Wie lange dauert die Lektion „Wie eine Anfrage Ihre View erreicht“?
Die meisten CoddyKit-Lektionen dauern etwa 5–10 Minuten. Jede ist kompakt und interaktiv, sodass du stetig Fortschritte machst und genau dort weitermachst, wo du aufgehört hast – im Web und in der App.
Kann ich in dieser Django Academy-Lektion Code schreiben und ausführen?
Ja. Jede Django Academy-Lektion enthält einen integrierten Code-Editor, sodass du echten Code direkt in deinem Browser schreibst und ausführst und sofort KI-Feedback erhältst — ohne lokale Einrichtung erforderlich.
Alle Lektionen in diesem Kurs
- Wie eine Anfrage Ihre View erreicht
- Das HttpRequest-Objekt
- Eine HttpResponse zurückgeben
- Statuscodes und HttpResponse-Unterklassen