Hello Coders!
The video mentioned in this article presents Django Corporate an open-source starter enhanced with HOT Reload when running in Docker. This is useful for those that prefer to write the code in isolated environments like Docker and see the changes without restarting the instance (source code saved on GitHub). Thanks for reading!
- 👉 Django Corporate - official
Product Page
- 👉 Django Corporate -
LIVE Demo
This enhancement was possible based on the following changes made to the Docker scripts:
✅ Define the codebase as a volume in docker-compose.yml
version: "3.8"
services:
appseed-app:
container_name: appseed_app
restart: always <-- NEW (For HOT reload)
build: .
volumes:
- ./:/app <-- NEW (For HOT reload)
networks:
- db_network
- web_network
✅ Force Gunicorn reload in entrypoint.sh
#!/bin/bash
set -e
# Function to start Gunicorn with dynamic reload-extra-file options
start_gunicorn() {
# Generate the reload-extra-file options dynamically
extra_files=$(find /app/templates -name "*.html" -printf "--reload-extra-file %p ")
# Start Gunicorn
echo "Starting Gunicorn..."
gunicorn --config gunicorn-cfg.py --reload --reload-engine=poll $extra_files core.wsgi
}
# Start Gunicorn
start_gunicorn
The above changes combined will trigger a HOT Reload in Docker if we change the Python code or the template files. The demonstration of this feature can be visualized in this short YoutTube material:
Thanks for reading! For more resources, feel free to access:
👉 More ui themes and templates - free & paid products
👉 Admin Dashboards - a huge index with templates and apps
Top comments (0)