Skip to main content

Baby Tools Shop

A simple Django-based web application for browsing baby product categories and products.

This project is part of a DevSecOps course and demonstrates how to run the application inside a Docker container and deploy it to a Linux server.


Table of Contents


Description

The Baby Tools Shop is a lightweight demo webshop built with Django.

Users can browse product categories and products, while administrators can manage content through the Django admin interface.

This project demonstrates:

  • Django project structure
  • server-side rendered web applications
  • Docker containerization
  • environment-based configuration
  • deployment to a remote server
  • secure secret handling with .env

The project was built as a practical DevSecOps exercise.


Tech Stack

  • Python: 3.9
  • Framework: Django 4.0.2
  • Database: SQLite
  • Containerization: Docker
  • Web Server: Django development / Gunicorn-ready setup
  • Configuration: Environment Variables

Project Structure

baby-tools-shop/
├─ babyshop_app/
│ ├─ babyshop/
│ ├─ products/
│ ├─ templates/
│ ├─ static/
│ └─ manage.py
├─ .gitignore
├─ Checklist_Baby_Tools_Shop
├─ Dockerfile
├─ example.env
├─ requirements.txt
└─ README.md

Quickstart

Prerequisites

Required tools:

  • Docker installed
  • Git installed

Run with Docker

1. Clone the repository

git clone https://github.com/ognjenmanojlovic/baby-tools-shop.git
cd baby-tools-shop

2. Create your environment file

cp example.env .env

Open .env and adjust the values to your environment.

3. Build the Docker image

docker build -t baby-tools-shop .

4. Run the container

docker run --rm --env-file .env -p 8025:8025 baby-tools-shop

5. Open in browser

http://127.0.0.1:8025

Usage

Admin Panel

To access the Django admin interface:

http://127.0.0.1:8025/admin

Create an admin user:

docker exec -it baby-tools-shop python babyshop_app/manage.py createsuperuser

Creating Categories and Products

Inside the Django admin panel:

  • create categories
  • create products
  • assign prices
  • upload product images
  • manage descriptions

Static and Media Files

  • Static files are served by Django
  • Uploaded product images are stored inside media/
  • Media files are excluded from Git

Configuration

Environment Variables

The project uses environment variables for configurable and sensitive settings:

DJANGO_SECRET_KEY
DJANGO_DEBUG
DJANGO_ALLOWED_HOSTS

Values should be stored inside .env and never committed publicly.


Deployment

Deploying to a Server

1. Install Docker

sudo apt update
sudo apt install -y docker.io

2. Clone the repository

git clone https://github.com/ognjenmanojlovic/baby-tools-shop.git
cd baby-tools-shop
git checkout development

3. Prepare environment file

cp example.env .env

Edit .env and configure:

  • secure DJANGO_SECRET_KEY
  • DJANGO_ALLOWED_HOSTS=<your-server-ip>

4. Build image

sudo docker build -t baby-tools-shop .

5. Run container

sudo docker run -d --restart unless-stopped --env-file .env -p 8025:8025 --name baby-tools-shop baby-tools-shop

6. Open in browser

http://<your-server-ip>:8025

Testing Checklist

  • Application runs successfully inside Docker
  • Server deployment completed
  • Public access works on port 8025
  • Environment variables loaded correctly
  • Django admin accessible
  • Product management works

Security Notes

  • No passwords or secrets committed
  • .env excluded via .gitignore
  • Use strong secret keys
  • Restrict ALLOWED_HOSTS
  • Keep Docker host updated
  • Use reverse proxy / HTTPS in production

Skills Demonstrated

This project demonstrates practical skills in:

Skill AreaDemonstrated Through
Python DevelopmentDjango application
Web DevelopmentCategories / products
ContainerizationDocker workflow
DeploymentLinux server hosting
Security AwarenessSecret handling
Configuration Management.env setup
DevSecOps FoundationsApp + container + deployment

Conclusion

The Baby Tools Shop project demonstrates how to package a Django application into Docker and deploy it securely to a remote Linux server.

It combines backend development, containerization, configuration management, and deployment fundamentals in one practical beginner-friendly DevSecOps project.


Author

Ognjen Manojlovic