Add STATIC_ROOT and MEDIA_ROOT to .env.example - #612
Merged
bpepple merged 2 commits intoSep 3, 2026
Conversation
settings.py reads both through `config()` with no default, in the branch that runs when DEBUG is on, and the example sets DEBUG=True. So copying the file as its own first line instructs raises UndefinedValueError on `manage.py` before anything else happens. Of the 19 variables settings.py requires without a default, these were the only two the example did not declare.
bpepple
approved these changes
Sep 3, 2026
bpepple
left a comment
Member
There was a problem hiding this comment.
Looks good, only change I made was updating the .gitignore for those directories. Thx!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What happens
.env.exampleopens with# Copy this file to .env and fill in all values.Doing exactly that and runningmanage.pyfails before anything else:The example sets
DEBUG=True,settings.py:354branches onif not DEBUG, and the local-storage branch readsconfig("STATIC_ROOT")andconfig("MEDIA_ROOT")with no default. Neither name is in the example.Why declaring them rather than defaulting them
Of the 19 variables
settings.pyrequires without a default, these two were the only ones the example did not declare. The project keeps the example complete, so this follows that rather than adding defaults tosettings.py.The values are the conventional Django ones and match how the S3 branch names things.
Alternative
If you would rather the development path work with no
.envediting at all,config("STATIC_ROOT", default=BASE_DIR / "staticfiles")does that instead, and I can send it that way.