Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Docker Deployment Guide

This guide explains how to deploy the project using Docker and Docker Compose.


Project Overview

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

Features

  • Modern Django project structure (users, posts apps)
  • 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

Requirements

  • Docker and Docker Compose must be installed on your system.
  • The project repository should contain all required files, including:
    • docker-compose.yml
    • Dockerfile
    • .env
    • and any other files required to run the application.

Deployment Steps

1. Clone the repository

git clone https://github.com/AlexTkDev/spa.git
cd spa

2. Configure environment variables

Rename 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=5432

These 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())'

3. Build and start the containers

From the project root (where docker-compose.yml and Dockerfile are located), run:

docker-compose up -d

4. Verify the deployment

Once the containers are running, the application will be available at:

http://localhost:9000

Using the Pre-built Docker Image

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

About

This project is a Django web application with PostgreSQL, deployed in Docker. It includes user registration, authentication, and management of posts and comments. It uses `docker-compose` to run services. Supports API, WebSockets, and protection against XSS/SQL injections. 🚀

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages