0Pricing
Flask Academy · Lektion

Wie aus einer Anfrage eine Antwort wird

Verfolgen Sie den Weg von Client über View bis zur Antwort.

Wie aus einer Anfrage eine Antwort wird ist eine kostenlose Flask Academy-Lektion auf CoddyKit. Dies ist Lektion 2 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 Flask Academy-Lernpfads, und dein Fortschritt wird über Web und CoddyKit-App synchronisiert. Der Flask Academy-Kurs umfasst insgesamt 4 Lektionen.

Teile dieser Lektion wurden noch nicht übersetzt und werden auf Englisch angezeigt.

The Round Trip

Every page view is a round trip: the browser sends a request, your server does work, and a response travels back. Let us trace that journey.

It Starts with a Request

A user clicks a link, and the browser sends an HTTP request. It carries the method, the URL path, and some headers describing the client.

Flask Matches the URL

Flask reads the path and finds the matching route. If no route matches, you get a 404 before any view function ever runs.

Your View Function Runs

Once matched, Flask calls your view function. This is where your code runs: read input, do logic, and decide what to send back.

@app.route("/time")
def time():
    return "It is now"

The Request Object

Inside the view, the request object holds everything the client sent. You import it from Flask to read details about the incoming call.

from flask import request

Building the Body

Your function returns a value, and that value becomes the response body. It can be text, HTML, or JSON depending on what you build.

The Response Object

Flask wraps your return value in a response object. That object bundles the body together with a status code and headers.

Status Codes Travel Back

Every response carries a status code. A 200 means success, while a 404 or 500 signals that something went wrong along the way.

Headers Describe the Reply

Response headers describe the body, like its content type and length. The browser reads them to know how to render what you sent.

The Browser Renders It

Finally the browser receives the response, reads the headers, and paints the body on screen. The round trip is complete.

One Request, One Response

The rule is simple: each request gets exactly one response. Your view runs, returns once, and Flask ships that single reply back.

Quick Check

Trace the request cycle in your head, then answer.

Recap

You traced the cycle: request in, route match, view runs, response out. Knowing this flow makes every Flask bug far easier to find. 🔁

Häufig gestellte Fragen

Ist die Lektion „Wie aus einer Anfrage eine Antwort wird“ kostenlos?

Ja — der vollständige Text von „Wie aus einer Anfrage eine Antwort wird“ ist hier im Web kostenlos zu lesen. Um sie interaktiv zu üben (integrierter Code-Editor und 24/7 KI-Tutor) und den Rest des Flask Academy-Kurses freizuschalten, upgrade auf CoddyKit PRO. Der Flask Academy-Kurs umfasst insgesamt 4 Lektionen.

Was lerne ich in „Wie aus einer Anfrage eine Antwort wird“?

Verfolgen Sie den Weg von Client über View bis zur Antwort. Du übst Flask 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 Flask Academy zu starten?

Keine Vorkenntnisse erforderlich. Flask 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 2 von 4.

Wie lange dauert die Lektion „Wie aus einer Anfrage eine Antwort wird“?

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 Flask Academy-Lektion Code schreiben und ausführen?

Ja. Jede Flask 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

  1. Der Decorator @app.route
  2. Wie aus einer Anfrage eine Antwort wird
  3. Strings, HTML und Statuscodes zurückgeben
  4. Mehrere Routen in einer App
← Zurück zu Flask Academy