Deploying a Wger App
Introduction
Wger is an open-source workout and nutrition tracker built with Django. This guide shows how to containerize Wger with a Dockerfile, connect it to PostgreSQL, persist media uploads, and deploy it to Klutch.sh over HTTP.
Prerequisites
- GitHub repository containing your Dockerfile.
- PostgreSQL database (managed or deployed separately).
- Klutch.sh project ready in klutch.sh/app.
Project structure
.└── DockerfileSample Dockerfile
FROM wger/server:latest
# Default Django port for WgerENV PORT=8000EXPOSE 8000Required environment variables
DATABASE_URL– e.g.,postgres://USER:PASSWORD@HOST:PORT/DBDJANGO_SETTINGS_MODULE=wger.settingsDJANGO_SECRET_KEY– strong secretPORT=8000
Optional environment variables
ALLOWED_HOSTS=example-app.klutch.shDEBUG=falseTIME_ZONE=UTC- Email settings if you enable notifications.
Persistence
Persist media uploads and static collections:
- Mount path:
/home/wger/media - Size: based on expected uploads (images, PDFs, exports)
Networking
- Protocol: HTTP
- Internal port:
8000 - Users reach
https://example-app.klutch.shwhile Klutch.sh routes to port8000inside the container.
Health check (recommended)
curl -I http://localhost:8000Deployment on Klutch.sh
- Push your Dockerfile to GitHub.
- In klutch.sh/app, create a new app and select GitHub as the source.
- Klutch.sh automatically detects the Dockerfile in the repository root.
- Select HTTP traffic and set the internal port to
8000. - Add environment variables for
DATABASE_URL,DJANGO_SECRET_KEY, andALLOWED_HOSTS. Mark secrets as sensitive. - Attach a persistent volume at
/home/wger/mediasized for your uploads. - Deploy. After the app starts, create your admin user via the Wger UI and begin configuring exercises and plans.
Verification
-
UI: open
https://example-app.klutch.shand confirm the Wger home page loads. -
Quick check:
Terminal window curl -I https://example-app.klutch.sh
Next steps
- Set up email for password resets and notifications.
- Enable backups for the PostgreSQL database and the media volume.
- Adjust
ALLOWED_HOSTSandDEBUGfor production hardening.