Uploaded by avinash nit

Django Online Training - NareshIT

advertisement
Django with REST API
https://nareshit.com/courses/django-online-training
Course Overview
• Objective: Learn how to develop and expose RESTful APIs
with Django and Django REST Framework.
• Audience: Developers with basic Python knowledge looking
to expand into web applications and REST API development.
• Prerequisites: Basic understanding of Python and Django
https://nareshit.com/courses/django-online-training
Agenda
• Introduction to Django and RESTful APIs
• Setting up Django and Django REST Framework
• Building APIs: Endpoints, Serializers, and Views
• Authentication and Permissions
• Advanced API Features: Pagination, Filtering, and Versioning
• Testing and Deploying APIs
• Final Project and Hands-On Exercises
https://nareshit.com/courses/django-online-training
What is Django?
• Definition: Django is a high-level Python web framework that
encourages rapid development and clean, pragmatic design.
Key Features
• MVC (Model-View-Controller) structure
• Built-in admin interface
• ORM (Object-Relational Mapping) system
• Middleware support
https://nareshit.com/courses/django-online-training
Understanding RESTful APIs
What is REST?
• Representational State Transfer (REST) is an
architectural style for creating scalable web services.
• Based on HTTP methods: GET, POST, PUT, DELETE, etc.
Why Use REST with Django?
• Seamless integration with Django’s ORM
• Allows for a standardized, decoupled architecture
https://nareshit.com/courses/django-online-training
Setting Up
DjangoREST Framework (DRF)
• Installing Django and DRF
Commands: pip install django and pip install djangorestframework
• Setting Up a Django Project
django-admin startproject projectname
• Adding DRF to Django Project
Update INSTALLED_APPS with 'rest_framework'
https://nareshit.com/courses/django-online-training
Building Your First APIEndpoint
• Define the Model : Create Django models to represent data.
Create a Serializer:
• Purpose: Convert Django model instances to JSON format and vice
versa.
• Example: from rest_framework import serializers
Define Views and URL Patterns:
• Use Django views to handle API requests
• Set up URL routing for API endpoint
https://nareshit.com/courses/django-online-training
API Authentication & Permissions
• Types of Authentication in DRF:
⚬ Basic, Token, and Session Authentication
• Permissions:
⚬ Configure who can access which resources
⚬ Use built-in permissions (IsAuthenticated,
IsAdminUser) or custom permissions
https://nareshit.com/courses/django-online-training
Advanced API Features
• Pagination: Limit the number of items returned in API
responses
• Filtering: Retrieve specific data based on parameters
• Versioning: Enable version control for APIs to support
backward compatibility
https://nareshit.com/courses/django-online-training
Testing Your APIs
• Why Testing is Important
⚬ Ensures reliability and prevents regressions.
• Tools for Testing
⚬ Django’s built-in testing framework
⚬ DRF test utilities and tools like Postman for API testing
https://nareshit.com/courses/django-online-training
Deploying Django REST APIs
• Hosting Options: Deploy APIs on platforms like Heroku,
DigitalOcean, or AWS.
• Configuring for Production:
⚬ Secure settings, database configurations, and static files
management.
• Containerization: Use Docker for consistent deployment
across environments.
https://nareshit.com/courses/django-online-training
Project and Hands-On Exercises
• Final Project: Develop a small application with multiple
endpoints, CRUD operations, and authentication.
• Hands-On Exercises:
⚬ Creating serializers and views
⚬ Adding custom permissions
⚬ Integrating with a front-end application (optional)
https://nareshit.com/courses/django-online-training
THANK YOU
For More Information
Address : 2nd Floor, Durga Bhavani Plaza,
Satyam Theatre Road, Ameerpet ,
Hyderabad, Telangana - 500016.
Phone : +91-8179191999
Email : online@nareshit.com
https://nareshit.com/courses/django-online-training
Download