About the course
Our three-day hands-on workshop provides a comprehensive journey through Django REST Framework (DRF), guiding you from fundamental setup to advanced production architecture. We begin by establishing a solid foundation in DRF's core components—Serializers and Views—before moving into critical, real-world topics.
You will master advanced serialization, implement powerful query optimization techniques, design custom permission systems, and integrate enterprise-level security using JWT authentication. The course culminates in practical sessions on robust testing, effective documentation, and production deployment best practices, ensuring you leave as a competent DRF specialist ready to build highly scalable and secure APIs.
Instructor-led online and in-house face-to-face options are available - as part of a wider customised training programme, or as a standalone workshop, on-site at your offices or at one of many flexible meeting spaces in the UK and around the World.
-
- Implement DRF Fundamentals: Confidently use DRF's built-in Serializers and ViewSets to perform standard CRUD operations.
- Handle Complex Data: Design advanced serializers for nested data, custom fields, and managing object relationships effectively.
- Optimize Performance: Identify and resolve common N+1 query problems and apply caching, filtering, and advanced pagination.
- Enforce Security: Implement secure API access using custom object-level permissions and JSON Web Token (JWT) authentication.
- Customize Architecture: Structure large projects using DRF Routers and write custom ViewSet logic for unique business requirements.
- Ensure Quality: Write comprehensive unit and integration tests for all API components and configure production logging.
-
This course is ideal for Python Backend Developers, Software Engineers, and Data Scientists who have a solid working knowledge of the core Django framework (Models, ORM, Views) and are ready to start building or modernizing high-performance APIs.
-
Attendees should have attended our Intro to Python and Django training course, or have equivalent experience:
Strong Proficiency in Python 3.8+: Comfort with classes, functions, and the standard library.
Working knowledge of the Django framework: Experience with Django Models, the ORM, and basic views.
Understanding of fundamental REST principles and HTTP methods.
-
This Django Rest Framework course is available for private / custom delivery for your team - as an in-house face-to-face workshop at your location of choice, or as online instructor-led training via MS Teams (or your own preferred platform).
Get in touch to find out how we can deliver tailored training which focuses on your project requirements and learning goals.
-
Introduction to DRF and REST Principles
Review of REST architecture and HTTP methods (GET, POST, PUT, DELETE).
Setting up the DRF environment and initial configuration in Django settings.
An introduction to the Browsable API.
Basic Serializers and Data Validation
Creating a basic ModelSerializer for Django Models.
Handling data conversion and built-in validation.
Using simple custom validators at the field level.
Function-Based Views (FBVs)
Using the @api_view decorator.
Implementing basic CRUD endpoints using FBVs.
Class-Based Views and Generic Views
Using APIView for custom logic.
Utilizing Generic Views (e.g., ListAPIView, RetrieveUpdateDestroyAPIView) as CRUD shortcuts.
Advanced Serializer Techniques
Handling nested relationships and writable nested serializers.
Writing custom SerializerMethodField for computed values.
Customizing serializer output with to_representation.
ViewSets, Routers, and Structure
Mastering ModelViewSet and GenericViewSet.
Organizing the API structure using Default Routers and custom base routers.
Overriding ViewSet methods (get_queryset, perform_create).
Data Filtering and Searching
Implementing built-in filtering (e.g., SearchFilter, OrderingFilter).
Advanced filtering using django-filter for custom lookups.
Strategies for complex searching and ordering.
API Performance and Optimization
Identifying and fixing the N+1 query problem (using select_related and prefetch_related).
Pagination strategies (Limit/Offset, Cursor) and their appropriate use cases.
Introduction to basic view-level caching.
Security Foundations and Permissions
Review of built-in permissions (IsAuthenticated, IsAdminUser).
Writing custom object-level permissions (e.g., ensuring a user can only modify their own data).
Implementing different throttling strategies to protect API resources.
Advanced Authentication (JWT)
Implementing JSON Web Token (JWT) authentication using djangorestframework-simplejwt.
Managing the JWT lifecycle (token refresh, blacklisting, secure storage).
Testing and Documentation
Writing robust unit tests for serializers, permissions, and custom views using Pytest.
Using DRF's APITestCase for functional API endpoint testing.
Generating comprehensive API documentation (Swagger/OpenAPI schema).
Monitoring and Deployment
Configuring logging and error handling best practices.
Setting up CORS (Cross-Origin Resource Sharing) headers.
Containerization with Docker and optimizing the WSGI server (Gunicorn) for production.
-
Core Documentation and Frameworks
These are the primary references for the underlying frameworks and tools used in the course:
Django REST Framework (DRF) Official Documentation:
The definitive guide for everything DRF, featuring detailed explanations on serializers, permissions, authentication, and advanced customization techniques.
Django Official Documentation:
Essential for reviewing advanced concepts related to the Django ORM, Models, and Custom User Models which underpin all DRF security and data operations.
Specialized Libraries
These are the libraries covered in the "Advanced Security and Filtering" modules:
Django REST Framework Simple JWT (djangorestframework-simplejwt):
The most popular library for implementing modern, token-based authentication (JWT) in DRF. Necessary for Day 3's security section.
https://django-rest-framework-simplejwt.readthedocs.io/en/latest/
Django Filter (django-filter):
The standard library for adding complex, reusable filtering and searching to DRF ViewSets. Covered in the advanced ViewSet and filtering module.
Development and Quality Tooling
These tools are crucial for ensuring code quality, security, and performance:
Pytest:
The industry-standard testing framework in Python. Used for writing the comprehensive unit and integration tests for serializers and views (covered on Day 3).
Django Debug Toolbar:
An indispensable tool for identifying and fixing performance issues like the N+1 query problem directly in development. Highly recommended for the optimization module.
Python Extension for VS Code (Microsoft):
The essential VS Code extension for Python development, providing debugging, linting (Pylint), and IntelliSense for a highly productive workflow. You are welcome to use your own preferred IDE during the training though.
https://marketplace.visualstudio.com/items?itemName=ms-python.python
Deployment and Production
Here are some deployment options you may wish to consider
Gunicorn:
The recommended WSGI server for running Django and DRF applications in production with high concurrency.
Docker:
The fundamental tool for containerizing the application, separating dependencies, and ensuring a consistent environment from development to production.
Trusted by



