This guide explains how to deploy the project using Docker and Docker Compose.
This is a Django learning project that supports user registration, blog posts, and threaded comments. The project includes:
- A custom user model with a unique email address and homepage
- Secure storage and rendering of user-generated content (HTML sanitization and XSS protection)
- Nested comments (parent/replies)
- CAPTCHA protection against spam
- Clean and maintainable code structure with docstrings,
help_text, reusable forms, and class-based views
- Modern Django project structure (
users,postsapps) - Class-based views and reusable mixins
- Pagination and sorting for posts and comments
- Docker environment for quick setup
- Examples of custom validators and extending Django's built-in models
- Docker and Docker Compose must be installed on your system.
- The project repository should contain all required files, including:
docker-compose.ymlDockerfile.env- and any other files required to run the application.
git clone https://github.com/AlexTkDev/spa.git
cd spaRename the .env.example file in the project root to .env and fill in your environment variables:
SECRET_KEY=""
# Database
DATABASE_NAME=***
DATABASE_USER=***
DATABASE_PASSWORD=***
DATABASE_PORT=5432These variables are used to configure the database connection.
Generate a Django secret key using the following command (Linux/macOS), then paste it into your .env file:
python -c 'from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())'From the project root (where docker-compose.yml and Dockerfile are located), run:
docker-compose up -dOnce the containers are running, the application will be available at:
http://localhost:9000
Instead of building the project locally, you can download the pre-built image from Docker Hub and run it on your machine:
docker pull alextkdev/spa:prod