Skip to content

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

.
└── Dockerfile

Sample Dockerfile

FROM wger/server:latest
# Default Django port for Wger
ENV PORT=8000
EXPOSE 8000

Required environment variables

  • DATABASE_URL – e.g., postgres://USER:PASSWORD@HOST:PORT/DB
  • DJANGO_SETTINGS_MODULE=wger.settings
  • DJANGO_SECRET_KEY – strong secret
  • PORT=8000

Optional environment variables

  • ALLOWED_HOSTS=example-app.klutch.sh
  • DEBUG=false
  • TIME_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.sh while Klutch.sh routes to port 8000 inside the container.
Terminal window
curl -I http://localhost:8000

Deployment on Klutch.sh

  1. Push your Dockerfile to GitHub.
  2. In klutch.sh/app, create a new app and select GitHub as the source.
  3. Klutch.sh automatically detects the Dockerfile in the repository root.
  4. Select HTTP traffic and set the internal port to 8000.
  5. Add environment variables for DATABASE_URL, DJANGO_SECRET_KEY, and ALLOWED_HOSTS. Mark secrets as sensitive.
  6. Attach a persistent volume at /home/wger/media sized for your uploads.
  7. 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.sh and 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_HOSTS and DEBUG for production hardening.