Skip to content

DjangoBlogSystem is a simple and extensible blogging platform built with the Django web framework. It allows users to create, edit, view, and manage blog posts through a clean user interface and an admin dashboard.

Notifications You must be signed in to change notification settings

kientech/DjangoBlogSystem

Repository files navigation

DJ Blog - Django Blog Platform

A modern, feature-rich blog platform built with Django, featuring user authentication, content management, and a responsive design.

Features

Core Features

  • User Authentication & Management: Complete user registration, login, profile management
  • Blog Post Management: Create, edit, delete, and categorize blog posts
  • User Profiles: Rich user profiles with avatars and activity tracking
  • Responsive Design: Modern UI built with Bootstrap 5
  • Admin Interface: Full Django admin integration

Advanced Features

  • Activity Tracking: Monitor user engagement and post interactions
  • Category System: Organize posts with categories and tags
  • Media Management: Handle image uploads and file management
  • Security: Rate limiting, CSRF protection, secure authentication
  • Docker Support: Containerized deployment with Docker and Docker Compose

Technology Stack

  • Backend: Django 4.2.7, Python 3.11
  • Database: PostgreSQL 15
  • Cache: Redis 7
  • Web Server: Nginx + Gunicorn
  • Frontend: Bootstrap 5, HTML5, CSS3
  • Containerization: Docker, Docker Compose

Quick Start

Prerequisites

  • Docker and Docker Compose
  • Python 3.11+ (for local development)
  • PostgreSQL (for local development)

Using Docker (Recommended)

  1. Clone the repository

    git clone <repository-url>
    cd dj-blog
  2. Create environment file

    cp .env.example .env
    # Edit .env with your configuration
  3. Start the application

    docker-compose up -d
  4. Run migrations

    docker-compose exec web python manage.py migrate
  5. Create superuser

    docker-compose exec web python manage.py createsuperuser
  6. Access the application

Local Development

  1. Clone and setup virtual environment

    git clone <repository-url>
    cd dj-blog
    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
  2. Install dependencies

    pip install -r requirements.txt
  3. Setup environment variables

    cp .env.example .env
    # Edit .env with your local configuration
  4. Setup database

    python manage.py migrate
    python manage.py createsuperuser
  5. Run development server

    python manage.py runserver

Project Structure

dj-blog/
├── accounts/                 # User authentication and profiles
│   ├── models.py            # User profile and activity models
│   ├── views.py             # Authentication views
│   ├── forms.py             # User forms
│   └── urls.py              # Account URLs
├── blog/                    # Blog application
│   ├── models.py            # Post and category models
│   ├── views.py             # Blog views
│   ├── forms.py             # Blog forms
│   └── urls.py              # Blog URLs
├── templates/               # HTML templates
│   ├── base.html            # Base template
│   ├── accounts/            # Account templates
│   └── blog/                # Blog templates
├── static/                  # Static files (CSS, JS, images)
├── media/                   # User uploaded files
├── manage.py                # Django management script
├── requirements.txt         # Python dependencies
├── Dockerfile              # Docker configuration
├── docker-compose.yml      # Docker Compose configuration
├── nginx.conf              # Nginx configuration
└── README.md               # This file

Configuration

Environment Variables

Create a .env file with the following variables:

# Django
DEBUG=True
SECRET_KEY=your-secret-key-here
ALLOWED_HOSTS=localhost,127.0.0.1

# Database
DATABASE_URL=postgresql://user:password@localhost:5432/djblog

# Redis
REDIS_URL=redis://localhost:6379/0

# Email
EMAIL_BACKEND=django.core.mail.backends.console.EmailBackend
EMAIL_HOST=smtp.gmail.com
EMAIL_PORT=587
EMAIL_USE_TLS=True
EMAIL_HOST_USER=your-email@gmail.com
EMAIL_HOST_PASSWORD=your-app-password

# Media and Static
MEDIA_URL=/media/
STATIC_URL=/static/

Database Configuration

The application uses PostgreSQL by default. For local development, you can use SQLite by modifying the database settings in settings.py.

API Documentation

The application includes a REST API with the following endpoints:

  • GET /api/posts/ - List all posts
  • POST /api/posts/ - Create a new post
  • GET /api/posts/{id}/ - Get post details
  • PUT /api/posts/{id}/ - Update a post
  • DELETE /api/posts/{id}/ - Delete a post

API documentation is available at /api/docs/ when running in development mode.

Deployment

Production Deployment

  1. Update environment variables

    DEBUG=False
    SECRET_KEY=your-production-secret-key
    ALLOWED_HOSTS=your-domain.com
  2. Build and deploy with Docker

    docker-compose -f docker-compose.yml up -d --build
  3. Collect static files

    docker-compose exec web python manage.py collectstatic --noinput

Environment-Specific Configurations

  • Development: Use docker-compose.yml with debug enabled
  • Production: Use docker-compose.prod.yml with optimized settings

Testing

Run tests using pytest:

# Run all tests
pytest

# Run with coverage
pytest --cov=.

# Run specific app tests
pytest accounts/
pytest blog/

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Code Quality

The project uses several tools to maintain code quality:

  • Black: Code formatting
  • Flake8: Linting
  • isort: Import sorting
  • pytest: Testing

Run code quality checks:

black .
flake8 .
isort .

Security

This application includes several security features:

  • CSRF protection
  • XSS protection headers
  • Rate limiting
  • Secure password hashing
  • SQL injection protection
  • File upload validation

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

For support and questions:

  • Create an issue in the GitHub repository
  • Contact the development team
  • Check the documentation

Changelog

Version 1.0.0

  • Initial release
  • User authentication system
  • Blog post management
  • Responsive design
  • Docker support
  • Admin interface

About

DjangoBlogSystem is a simple and extensible blogging platform built with the Django web framework. It allows users to create, edit, view, and manage blog posts through a clean user interface and an admin dashboard.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published