Welcome to my Django REST Framework Practice Repository! 🎉
This repository contains all the practice code that I have written during my learning journey with the Django REST Framework (DRF). It covers all the essential topics, concepts, and features of DRF, providing a comprehensive resource for beginners and practitioners alike.
- Introduction to DRF: Setting up a Django project and integrating the Django REST Framework.
- Serializers:
- Understanding and implementing serializers.
- Model serializers and custom serializers.
- Views:
- Function-based views (FBV).
- Class-based views (CBV).
- Generic views.
- ViewSets.
- Routers:
- SimpleRouter.
- DefaultRouter.
- Nested routing.
- Authentication and Authorization:
- Token-based authentication.
- Session-based authentication.
- Permissions and custom permission classes.
- Pagination:
- PageNumberPagination.
- LimitOffsetPagination.
- CursorPagination.
- Validation:
- Built-in and custom validation rules.
- Field-level and object-level validations.
- Filters:
- Search filters.
- Ordering filters.
- Custom filter backends.
- Testing:
- Writing tests for APIs using Django’s test client.
- DRF-specific test utilities.
- Advanced Topics:
- Throttling.
- Custom response formats.
To run the code in this repository:
- Clone the repository:
git clone https://github.com/Muntasir2179/django-REST-framework.git cd django-REST-framework
- Create and activate a virtual environment:
python -m venv env source env/bin/activate # On Windows: env\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
- Apply migrations:
python manage.py migrate
- Run the server:
python manage.py runserver
- Access the application at:
http://127.0.0.1:8000/