Skip to content

Load local .env file for Django settings#22

Merged
csengor merged 1 commit into
kaplanPRO:0.6.x-devfrom
csengor:chore/env-file-support
Apr 19, 2026
Merged

Load local .env file for Django settings#22
csengor merged 1 commit into
kaplanPRO:0.6.x-devfrom
csengor:chore/env-file-support

Conversation

@csengor
Copy link
Copy Markdown
Member

@csengor csengor commented Apr 19, 2026

Summary

  • Adds python-dotenv (prod dep) and calls load_dotenv(BASE_DIR / ".env") in kaplancloud/settings.py so local manage.py runs pick up a repo-root .env automatically.
  • Ships .env.example at repo root with SECRET_KEY plus commented defaults for DEBUG/ALLOWED_HOSTS/CSRF_TRUSTED_ORIGINS — just enough to scaffold a SQLite + filesystem-storage dev setup.
  • Updates CLAUDE.md dev setup with a cp .env.example .env step.
  • .env is already gitignored; Docker Compose env_file: path is unchanged (shell/container env wins over the file by default).

Test plan

  • SECRET_KEY=shell-wins python manage.py check with no .env → passes
  • python manage.py check with .env only (no shell var) → passes
  • Precedence: shell SECRET_KEY overrides .env value
  • python manage.py test → 256 tests pass
  • ruff check . and ruff format --check . → clean

🤖 Generated with Claude Code

Adds python-dotenv so `kaplancloud/settings.py` reads a repo-root `.env`
on startup, letting local developers run `manage.py` commands without
exporting variables into the shell. Ships a minimal `.env.example` so
fresh checkouts can scaffold `SECRET_KEY` in one step. Existing env
precedence is preserved — shell/container variables still win over the
file, so the Docker Compose path is unchanged.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@csengor csengor merged commit 8b3c85a into kaplanPRO:0.6.x-dev Apr 19, 2026
2 checks passed
@csengor csengor deleted the chore/env-file-support branch April 19, 2026 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant