Skip to content

Latest commit

Β 

History

History
107 lines (77 loc) Β· 2.91 KB

File metadata and controls

107 lines (77 loc) Β· 2.91 KB

πŸ“ Django Blog App

A fully functional Django-based Blog Web Application with role-based access control, JWT authentication, RESTful APIs, blog and comment features, custom signals, management commands, and performance caching.


πŸš€ Features

πŸ‘₯ Authentication & User Roles

  • JWT token authentication using Djoser
  • Role-based access:
    • Admin: Full control
    • Staff: Moderate content
    • User: View, comment, create blog posts
  • Login/logout with user popup messages
  • Display logged-in username in the navbar

πŸ“š Blog & Comment System

  • Create, Read, Update, Delete (CRUD) for blog posts
  • Comment system with author name and time
  • Scrollable and styled comment section

πŸ” Search & Pagination

  • Search blogs by title/content
  • Paginated blog listing with Bootstrap styling

πŸ“‘ REST API

  • Secure API using Django REST Framework
  • Blog listing, creation, update, delete with token protection
  • Role-based access to endpoints
  • User list endpoint (admin only)

πŸ›  Custom Management Commands

  • create_demo_posts <count>: Generate dummy blogs
  • delete_all_posts: Delete all blog posts
  • Example: python manage.py create_demo_posts 10

πŸ”” Signals & Logging

  • Logs registration and login actions via custom Django signals

⚑ Performance Optimization

  • Implemented view-level and low-level caching to boost performance

πŸ–₯️ Tech Stack

  • Backend: Django, DRF, Djoser
  • Frontend: HTML, CSS, Bootstrap 5
  • Auth: JWT + Session Auth
  • Database: SQLite (easy switch to PostgreSQL)
  • Other: Django Signals, Caching, Custom Commands

βš™οΈ Setup Instructions

  1. Clone the repository:
        git clone https://github.com/yourusername/django-blog-app.git
        cd django-blog-app
    
  2. Create virtual environment and install dependencies:
        python -m venv venv
        source venv\Scripts\activate  
        pip install -r requirements.txt
    
  3. Apply migrations:
        python manage.py migrate
    
  4. Create Superuser
    python manage.py createsuperuser
    
  5. Run Server
    python manage.py runserver
    

πŸ§ͺ API Endpoints

Method Endpoint Description Auth
POST /api/token/ Get access + refresh tokens ❌
GET /api/blogs/ List all blogs βœ…
POST /api/blogs/ Create a blog βœ…
PUT /api/blogs/<id>/ Update a blog βœ…
DELETE /api/blogs/<id>/ Delete a blog βœ…
GET /api/users/ List all users (admin only) βœ…

πŸ’‘ Highlights

🎯 Role-Based Access Control

πŸ” JWT Authentication with Djoser

🧠 Custom Django Signals

βš™οΈ Management Commands

πŸš€ DRF API with Permissions

⚑ View-level Caching