https://github.com/sm-haris/django-rest-app
This comprehensive Django project demonstrates the power of Django REST Framework, showcasing features like RESTful API design, custom authentication, robust logging, user management (CRUD), and search/filtering capabilities. It exemplifies best practices for building secure and user-friendly REST APIs with Django.
https://github.com/sm-haris/django-rest-app
authentication authorization django django-rest-framework logging postgresql python rest-api
Last synced: 3 months ago
JSON representation
This comprehensive Django project demonstrates the power of Django REST Framework, showcasing features like RESTful API design, custom authentication, robust logging, user management (CRUD), and search/filtering capabilities. It exemplifies best practices for building secure and user-friendly REST APIs with Django.
- Host: GitHub
- URL: https://github.com/sm-haris/django-rest-app
- Owner: SM-Haris
- Created: 2024-07-10T13:42:40.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-07-10T14:27:13.000Z (11 months ago)
- Last Synced: 2025-01-16T07:56:49.766Z (5 months ago)
- Topics: authentication, authorization, django, django-rest-framework, logging, postgresql, python, rest-api
- Language: Python
- Homepage:
- Size: 10.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Django REST Backend
## Description
This Django project serves as a comprehensive demonstration of Django REST Framework's capabilities. It implements robust features, including:
* **RESTful API Design**: Endpoints adhere to RESTful principles, ensuring a clean and consistent API structure.
* **Authentication**: Secure access is provided using a custom implementation built upon Simple JWT for user authentication.
* **Authorization**: Fine-grained control over user permissions is not directly implemented in this example, but the groundwork can be laid for future integration.
* **Custom User Model**: A CustomUser class extends the default Django user model with additional fields or logic tailored to your application's needs.
* **Exception Handling**: Custom middlewares effectively catch and handle unhandled exceptions, providing informative error messages for debugging and user experience.
* **Audit Logging and Error Logging**: Essential actions and errors are logged to files for auditing, troubleshooting, and security purposes. Logs are rotated on a 5-day basis to manage storage efficiently.
* **User CRUD APIs**: Comprehensive REST APIs are created for user creation, retrieval, update, and deletion (CRUD) operations.
* **Token Refresh and Verification**: Dedicated API endpoints handle token refresh and verification for maintaining user sessions securely.
* **User Signup and Login**: Streamlined APIs facilitate user registration and login, allowing users to interact with the application.
* **Custom Mixins**: Reusable mixins are designed to simplify queryset filtering operations within your API views.
* **Serializers:** Serializer classes map between Python objects (models) and JSON representations, ensuring data integrity and efficient data exchange.
* **Search and Filtering**: Powerful query parameters leverage Django and REST Framework filters, enabling users to search and filter data based on specific criteria.
* **Database Connection**: The project is configured to connect to a PostgreSQL database for data storage and persistence.## Prerequisites
* Python 3.x (Recommended: Use a virtual environment)
* pip (Package installer for Python)
* PostgreSQL database server
* Installation## Clone the repository:
```Bash
git clone https://github.com/SM-Haris/django-rest-app.git
```## Create a virtual environment (recommended for isolation):
```Bash
python -m venv venv
source venv/bin/activate # For Linux/macOS
venv\Scripts\activate.bat # For Windows
```## Install project dependencies:
```Bash
pip install -r requirements.txt
```## Apply database migrations:
```Bash
python manage.py migrate
```### (Optional) Create a PostgreSQL database and configure connection details in settings.py.
## Start the development server:
```Bash
python manage.py runserver
```
Access the API in your web browser, typically at http://127.0.0.1:8000/.