A modern, feature-rich blog platform built with Django, featuring user authentication, content management, and a responsive design.
- 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
- 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
- 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
- Docker and Docker Compose
- Python 3.11+ (for local development)
- PostgreSQL (for local development)
- 
Clone the repository git clone <repository-url> cd dj-blog 
- 
Create environment file cp .env.example .env # Edit .env with your configuration
- 
Start the application docker-compose up -d 
- 
Run migrations docker-compose exec web python manage.py migrate
- 
Create superuser docker-compose exec web python manage.py createsuperuser
- 
Access the application - Main site: http://localhost:8000
- Admin panel: http://localhost:8000/admin
 
- 
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 
- 
Install dependencies pip install -r requirements.txt 
- 
Setup environment variables cp .env.example .env # Edit .env with your local configuration
- 
Setup database python manage.py migrate python manage.py createsuperuser 
- 
Run development server python manage.py runserver 
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
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/The application uses PostgreSQL by default. For local development, you can use SQLite by modifying the database settings in settings.py.
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.
- 
Update environment variables DEBUG=False SECRET_KEY=your-production-secret-key ALLOWED_HOSTS=your-domain.com 
- 
Build and deploy with Docker docker-compose -f docker-compose.yml up -d --build 
- 
Collect static files docker-compose exec web python manage.py collectstatic --noinput
- Development: Use docker-compose.ymlwith debug enabled
- Production: Use docker-compose.prod.ymlwith optimized settings
Run tests using pytest:
# Run all tests
pytest
# Run with coverage
pytest --cov=.
# Run specific app tests
pytest accounts/
pytest blog/- Fork the repository
- Create a feature branch (git checkout -b feature/amazing-feature)
- Commit your changes (git commit -m 'Add amazing feature')
- Push to the branch (git push origin feature/amazing-feature)
- Open a Pull Request
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 .This application includes several security features:
- CSRF protection
- XSS protection headers
- Rate limiting
- Secure password hashing
- SQL injection protection
- File upload validation
This project is licensed under the MIT License - see the LICENSE file for details.
For support and questions:
- Create an issue in the GitHub repository
- Contact the development team
- Check the documentation
- Initial release
- User authentication system
- Blog post management
- Responsive design
- Docker support
- Admin interface