A robust blog API built with Django REST Framework featuring OAuth2 authentication, image uploads, and comprehensive CRUD operations.
- Blog Management: Create, read, update, and delete blog posts
- User Authentication: OAuth2 with Google integration and custom user registration
- Image Upload: Support for post images with media handling
- Search & Filtering: Advanced search and filtering capabilities
- API Documentation: Swagger/ReDoc integration for API documentation
- Custom Permissions: Author-only edit permissions with flexible access control
- Categories: Organize posts with category management
- Backend: Django 5.2.6, Django REST Framework 3.16.1
- Authentication: OAuth2, Social Auth (Google)
- Documentation: drf-yasg (Swagger/OpenAPI)
- Database: SQLite (development)
- Image Processing: Pillow
- Testing: Django Test Framework with coverage
- Clone the repository
git clone [email protected]:adityaxxz/BlogApp.git cd BlogApp
I've used uv which is rust-based and 100x faster than pip
-
Set up virtual environment
pip install uv uv venv source .venv/bin/activate # Linux .venv\Scripts\activate # Windows
-
Install dependencies
uv pip install -r requirements.txt
-
Run migrations
python manage.py migrate python manage.py createsuperuser
-
Start development server
python manage.py runserver
GET /api/
- List all published postsGET /api/posts/{slug}/
- Get specific post by slugGET /api/search/
- Search posts(use search/?search=)
POST /api/admin/create/
- Create new post (authenticated)PUT /api/admin/edit/{id}/
- Update post (authenticated)DELETE /api/admin/delete/{id}/
- Delete post (authenticated)
POST /api/user/register/
- User registrationPOST /auth/token/
- OAuth2 token endpoint
/swagger/
- Swagger UI/redoc/
- ReDoc documentation
- OAuth2 Setup: Configure Google OAuth2 credentials in
settings.py
- Media Files: Ensure media directory permissions for image uploads
- CORS: Configure allowed origins for frontend integration
python manage.py test
coverage run manage.py test
coverage html
drf/
├── blog/ # Blog models and basic views
├── blog_api/ # REST API endpoints and serializers
├── users/ # Custom user model and authentication
├── core/ # Django settings and main URLs
├── media/ # Uploaded images
└── templates/ # HTML templates
This project is open source and available under the MIT License.