Bỏ qua tới nội dung
TakoAPI
Quay lại kỹ năng

drf

bởi pradeepcep

Coding Agents & IDEs
514Lượt tải do clawskills.sh công bố
0Lượt xem
0 lượt thíchĐăng nhập để thích kỹ năng này
—Chưa có đánh giá
Đánh giá của bạn

Tóm tắt

Django REST Framework scaffolding best practices, and gotchas.

Mô tả

Kỹ năng này làm gì

Covers building REST APIs with Django REST Framework, including project setup, serializers, viewsets, routing, authentication, pagination, filtering, and query optimization. Includes guidance on common pitfalls like N+1 queries, silent permission bugs, and misplaced business logic.

Collects opinionated defaults and common pitfalls in one place so engineers avoid silent security bugs and performance problems that DRF does not surface on its own.

Khi nào nên dùng

  • Scaffolding a new Django REST API project from scratch
  • Adding token or JWT authentication to Django endpoints
  • Fixing N+1 query problems in DRF list views
  • Writing serializers with separate read and write representations
  • Setting up rate limiting for anonymous and authenticated users

Quy trình ví dụ

ĐẦU VÀO

User asks: Set up a new Django REST API project with authentication and pagination

AGENT
  1. 1

    Create a virtual environment and install django and djangorestframework

  2. 2

    Run django-admin startproject and manage.py startapp to scaffold the project

  3. 3

    Configure REST_FRAMEWORK settings with IsAuthenticated, JSONRenderer, and LimitOffsetPagination

  4. 4

    Create a ModelSerializer and ModelViewSet for the target resource

  5. 5

    Register the viewset with a DRF router and include the URLs in the main urls.py

ĐẦU RA

A working Django REST API with authenticated endpoints, paginated list views, and standard CRUD routes

Cài đặt

clawhub install pradeepcep/drf

Chạy lệnh CLI, hoặc dán prompt vào Claude Code, Cursor, Codex hay coding agent bạn đang dùng.

Liên kết