Troubleshooting

Common setup, runtime, deployment, and testing issues when running Pengin-Pi-3 locally or behind Docker Compose.

For installation steps, see Install. For Docker and Traefik architecture, see Deployment. For environment variables, see Configuration.


Startup & Environment Fallbacks

App starts with [settings] SES credentials not found or uses SQLite unexpectedly

Pengin-Pi-3 is designed to boot cleanly without external credentials:

  • Email (AWS_SES_ENABLED): Requires SES_USERNAME_SMTP, SES_PASSWORD_SMTP, and SES_SENDER to all be set. If any one is missing, EMAIL_BACKEND falls back to Django's console backend and send_mail() skips delivery.
  • Media (AWS_S3_ENABLED): Requires S3_KEY, S3_SECRET, and S3_BUCKET to all be set; otherwise uploads fall back to local storage.
  • Database (DB_ENGINE): If DB_ENGINE is set to PostgreSQL but any of DB_NAME, DB_USER, DB_PASSWORD, or DB_HOST is blank, main/settings.py prints a notice and falls back to local db.sqlite3.
  • reCAPTCHA (RECAPTCHA_ENABLED): Disabled unless both RECAPTCHA_SITE_KEY and RECAPTCHA_SECRET_KEY are set.

Check python manage.py check locally or docker compose logs web in production to see which fallbacks were triggered at startup.

Running tests locally without a .env or external services

Run Django's test runner directly (do not run test modules via python -m unittest):

python manage.py test

Tests run against SQLite, and suites that touch Django's cache (such as main/tests/test_wiki_permissions.py) override CACHES with LocMemCache via @override_settings so no external Postgres or Redis server is required.


Docker Compose & Traefik

network root_proxy not found on docker compose up

docker-compose.yml expects an external Docker network named root_proxy owned by Traefik. Either:

  • Connect your existing host Traefik instance to a root_proxy network, or
  • Start the bundled Traefik stack once first: docker compose -f docker-compose.traefik.yml up -d (or run ./deploy.sh, which handles this interactively).

TLS / Let's Encrypt certificate fails for www

The Nginx router rule in docker-compose.yml serves the bare domain, www.<domain>, and URL2, and requests certificates covering both. Ensure a DNS record exists for www as well as the root domain (see FAQ).

502 Bad Gateway behind Traefik

Traefik matched the hostname route, but the upstream nginx or web container is not responding yet:

  • Check container status and startup logs with docker compose ps and docker compose logs -f web.
  • On first boot, migrations and collectstatic run before Gunicorn/uWSGI begins serving.

FerretDB errors with schema "documentdb_api" does not exist

docker-compose.yml bind-mounts ./docker-entrypoint-initdb/01-create-app-db.sh as a single file at /docker-entrypoint-initdb.d/30-create-app-db.sh rather than replacing the directory. If the database volume was initialized without the image's built-in preload/install scripts (10-preload.sh, 20-install.sql), check the postgres container initialization logs and ensure the single-file mount wasn't replaced with a directory mount.


Redis & Caching

Redis connection errors in local development

CACHES in main/settings.py defaults to django_redis.cache.RedisCache at REDIS_URL (redis://127.0.0.1:6379). If Redis is not running locally:

  • SuperTemplateView degrades gracefully on Slug GET requests when Redis is unavailable rather than raising a 500 on every page.
  • Features or tests that directly read/write django.core.cache.cache require either a running Redis instance or @override_settings(CACHES=...) in tests.

macOS Local Development

Port 8000 already in use

On macOS, AirPlay Receiver frequently occupies port 8000 or 5000. Identify the process with lsof -i :8000 or start Django on another port:

python manage.py runserver 8080

Git mmap failed / stalled reads inside ~/Documents

If iCloud Drive Desktop & Documents Folders syncing is enabled on macOS, iCloud can evict .git/objects/pack files to cloud-only ("dataless") stubs, causing git commands to stall or fail with mmap failed. Clone repositories outside iCloud-synced folders (for example ~/Developer/ or ~/Projects/).


Wiki & Slug Routing

Reserved slug names rejected (wiki, create, edit, static, media, ...)

Slug.clean() and the wiki views reject child slugs named create or edit, as well as top-level slugs colliding with core routes (admin, login, signup, staff, wiki, create, edit, static, media, etc.) so pages do not become unreachable. The top-level home slug is explicitly allowed and maps to /.

403 Forbidden when trying to create or edit wiki pages

Wiki creation and editing require a signed-in staff account (is_staff=True, enforced via StaffRequiredMixin). Anonymous or non-staff accounts cannot create wikis or edit pages.


Next

  • Install — Docker and local setup paths
  • Deployment — full production Docker Compose and Traefik details
  • Configuration — all environment variables and defaults
  • Wiki Module — how the built-in wiki works