0Pricing
Django Academy · Lektion

DRF installieren und konfigurieren

DRF und die browsable API hinzufügen

DRF installieren und konfigurieren 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.

A REST API, Quickly

Django REST Framework, or DRF, layers a clean toolkit on top of Django so you can turn your models into a JSON API fast. 🚀

Install the Package

You add DRF the same way you add any Python library: with pip, then pin it in requirements so teammates get the same version.

pip install djangorestframework

Register the App

DRF only wakes up once you add rest_framework to your INSTALLED_APPS list in settings.py, right alongside your own apps.

INSTALLED_APPS = [
    # ...
    'rest_framework',
]

Why INSTALLED_APPS Matters

Adding it to INSTALLED_APPS lets Django discover DRF's templates, static files, and management commands automatically.

The REST_FRAMEWORK Dict

You configure DRF through a single REST_FRAMEWORK dictionary in settings.py, keeping all of its options in one tidy place.

REST_FRAMEWORK = {
    'DEFAULT_PERMISSION_CLASSES': [],
}

Default Renderers

By default DRF can return both raw JSON and a friendly HTML view, thanks to its built-in renderers you rarely have to touch.

The Browsable API

One reason DRF feels magical is the browsable API: open an endpoint in your browser and you get a clickable, documented page. ✨

Wire Up the URLs

DRF ships login views for the browsable API; you include them in your urls.py so you can sign in while testing endpoints.

urlpatterns = [
    path('api-auth/', include('rest_framework.urls')),
]

Verify the Install

A quick way to confirm DRF is wired in is to open the Django shell and import it without errors before writing any code.

python manage.py shell
>>> import rest_framework

Keep Settings Minimal

Start with an almost empty config. You only add keys to REST_FRAMEWORK when you genuinely need a behavior changed, not before.

You Are API-Ready

With DRF installed, registered, and its URLs included, your project is now ready to expose endpoints that speak JSON to any client.

Quick Check

Where does DRF need to be listed to activate?

Recap: DRF Set Up

You pip-installed DRF, added it to INSTALLED_APPS, included its auth URLs, and confirmed the import. Your API foundation is solid. 🎉

Häufig gestellte Fragen

Ist die Lektion „DRF installieren und konfigurieren“ kostenlos?

Ja — der vollständige Text von „DRF installieren und konfigurieren“ 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 „DRF installieren und konfigurieren“?

DRF und die browsable API hinzufügen 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 „DRF installieren und konfigurieren“?

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

  1. DRF installieren und konfigurieren
  2. Serializers: Model zu JSON
  3. APIView und die Funktion @api_view
  4. Die browsable API und Statuscodes
← Zurück zu Django Academy