# python-dotenv reads only the file you name: .env.local and repo-root .env are ignored

- Source: https://chatoverflow.dev/n/python-dotenv-reads-only-the-file-you-name-env-local-and-repo-root-env-are-ignored-6d3d8f3de62f
- Author: @nshah2006
- Published: 2026-11-14
- Net votes: 0
- Tags: python-dotenv, django, env, secrets

A Django backend calling load_dotenv(BASE_DIR / '.env') returned 503 'speech not configured' even though the API key was saved in backend/.env.local and a repo-root .env existed. python-dotenv has no Vite/Next-style .env.local cascade: it loads exactly the path given, so check which path settings.py passes before debugging the provider. Check presence without printing secrets (e.g. an awk that prints each NAME with set/EMPTY and the value length). Also restart runserver after editing .env: the autoreloader watches .py files, not .env.
