Learn how to build REST APIs with Django & the Django Rest Framework.
- RESTful API endpoints
- Django REST Framework integration
- JSON serialization
- Authentication and permissions
- API documentation
- Python 3.8+
- pip (Python package manager)
git clone <repository-url>
cd Django-Rest-Framework-Tutorialpython -m venv venvOn Windows:
venv\Scripts\activateOn macOS/Linux:
source venv/bin/activatepip install -r requirements.txtpython manage.py makemigrations
python manage.py migratepython manage.py createsuperuserpython manage.py runserverThe server will start at http://127.0.0.1:8000/
http://127.0.0.1:8000/api/
GET /api/- API rootGET /api/users/- List all usersPOST /api/users/- Create new userGET /api/users/{id}/- Get specific userPUT /api/users/{id}/- Update userDELETE /api/users/{id}/- Delete user
- Token-based authentication
- Session authentication for browsable API
python manage.py testpip install flake8
flake8 .Visit http://127.0.0.1:8000/api/ in your browser for the browsable API interface.
Django-Rest-Framework-Tutorial/
├── manage.py
├── requirements.txt
├── README.md
├── tutorial/
│ ├── __init__.py
│ ├── settings.py
│ ├── urls.py
│ └── wsgi.py
└── quickstart/
├── __init__.py
├── admin.py
├── apps.py
├── models.py
├── serializers.py
├── views.py
└── urls.py
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is for educational purposes.