A Django web application for generating branded product images with icons, containerized with Docker.
- J'ai créé un système de traitement d'images par lots : téléchargez plusieurs images de produits à la fois et traitez-les toutes ensemble
- J'ai créé un système d'icônes double : ajoutez des pictos verticaux sur le côté gauche et des pictos horizontaux sur le côté droit
- J'ai créé 5 emplacements de position : chaque côté a 5 positions (du bas vers le haut) pour placer différentes icônes
- J'ai créé une sélection d'icônes dynamique : les menus déroulants se remplissent automatiquement à partir de vos dossiers d'icônes
- J'ai créé un éditeur de prévisualisation interactif : glissez, redimensionnez et retournez les images de produits avec un éditeur basé sur canvas
- J'ai créé une sortie WebP : génère des images WebP de haute qualité (95% de qualité) pour une taille de fichier optimale
- J'ai créé un système conteneurisé Docker : déploiement facile avec Docker Compose, pas besoin de configuration Python locale
- Docker Desktop installed and running (Download here)
- Git (to clone the repository)
git clone <your-github-repo-url>
cd micro# Build and start all containers
docker compose up --build
# Or run in detached mode (background)
docker compose up -d --buildThis will:
- Build the Django web application container
- Run database migrations automatically (using SQLite)
- Start the Django server on
http://localhost:8000
Open your browser and navigate to:
- Web Application: http://localhost:8000
- Open Docker Desktop
- Go to the Containers tab
- You should see the container running:
product-web(Django application with SQLite database)
# Start containers
docker compose up
# Start in background
docker compose up -d
# Stop containers
docker compose down
# Stop and remove volumes (clean database)
docker compose down -v
# View logs
docker compose logs
# View logs for the web service
docker compose logs web
# Rebuild containers
docker compose up --build
# Execute commands in container
docker compose exec web python manage.py migrate
docker compose exec web python manage.py createsuperuserThe application uses SQLite by default (no separate database container needed):
- Database file:
django_app/db.sqlite3 - The database is automatically created on first startup
- Migrations run automatically when the container starts
To manually run migrations:
docker compose exec web python manage.py migrateTo create a superuser (admin):
docker compose exec web python manage.py createsuperusermicro/
├── docker-compose.yml # Docker Compose configuration
├── Dockerfile # Docker image definition
├── .env.docker.example # Environment variables template
├── .gitignore # Git ignore rules
├── requirements.txt # Root-level dependencies
└── django_app/ # Django application
├── manage.py
├── requirements.txt
├── product_generator/ # Django project settings
├── generator/ # Main app
├── templates/ # HTML templates
├── media/ # Uploaded files
└── static/ # Static files
The application uses SQLite by default (no configuration needed).
If you want to use MySQL instead, you can:
- Add a MySQL service to
docker-compose.yml - Set
DB_ENGINE=mysqlin the environment variables - Configure MySQL connection settings
-
Check if Docker Desktop is running
- Look for Docker icon in system tray
- Open Docker Desktop and ensure it's running
-
Check if containers are actually running
docker compose ps
-
Check logs for errors
docker compose logs
If port 8000 is already in use:
- Edit
docker-compose.yml - Change the port mapping (e.g.,
"8001:8000"for web)
- Ensure the container is running:
docker compose ps - Check the logs:
docker compose logs web - SQLite database file is stored at
django_app/db.sqlite3(persisted via volume mount)
If you get permission errors:
sudo docker compose up --build-
Push to GitHub:
git add . git commit -m "Add Docker setup" git push origin main
-
Share the repository URL with your team lead
-
Team lead can then:
- Clone the repository
- Follow the "Quick Start with Docker" steps above
- No need to install Python, SQLite, or any dependencies locally!
- Never commit
.env.dockerto Git (it's in.gitignore) - Change default passwords in production
- Use strong
SECRET_KEYin production - Set
DEBUG=Falsein production
- Vertical Pictos (Left Side): Select from icons in
Data/Vertical_pictos/folder (e.g., "0% THC", "Made in France", "Bio") - Horizontal Pictos (Right Side): Choose category first (CBD, CBG, Sativa, Indica, etc.), then select specific file
- Category-Based Icons: Horizontal pictos organized by product type with percentage/strength variants
- Background Image: Custom 800x800px background image with product centered automatically
- Product Resizing: Products automatically resized to max 350px while preserving aspect ratio
- Transparency Support: Product images maintain transparency (no white background frame)
- Batch Management: All images in a batch share the same icon configuration
- Backend: Django 4.2+ framework with SQLite database (MySQL supported)
- Image Processing: Pillow (PIL) library for image manipulation and composition
- Frontend: Bootstrap 5 UI with Font Awesome icons and vanilla JavaScript
- Canvas Editor: HTML5 Canvas API for interactive preview and editing
- File Storage: Django's default storage system for uploaded and generated images
- Docker Setup: Python 3.12-slim base image with automatic migrations on startup
- API Endpoints: RESTful API for dynamic file loading based on category selection
- Step 1: Upload multiple product images using the file input (supports JPG, PNG, GIF, WEBP)
- Step 2: Select 5 vertical pictos from dropdown menus (left side positions)
- Step 3: Select 5 horizontal pictos by choosing category then file (right side positions)
- Step 4: Click "Generate Product Images" to process all uploaded images
- Step 5: View batch results page showing original and generated images side-by-side
- Step 6: Click "Edit" button to open interactive preview editor for customization
- Step 7: Download individual images or custom-edited versions with custom filenames
- Data/Vertical_pictos/: Contains all left-side icon files (scanned dynamically for dropdown)
- Data/horizantal_Pictos/: Contains category subfolders (CBD, CBG, Sativa, etc.) with icon files
- backgrounds/: Stores background image files (background.jpg or background.png)
- generator/models.py: Database models (BatchSubmission, ProductSubmission)
- generator/views.py: Image processing logic and ProductIconGenerator class
- generator/forms.py: Dynamic form generation that scans icon folders
- templates/generator/: HTML templates with Bootstrap styling and JavaScript functionality
For more details about the Django application itself, see django_app/README.md
If you encounter issues:
- Check the logs:
docker compose logs - Ensure Docker Desktop is running
- Try rebuilding:
docker compose up --build - Check that port 8000 is not in use by other applications