Make secrets.json not being found an explicit error when DJANGOPROJECT_DATA_DIR is set #2097
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.
While helping someone setup the website in their system, they faced an issue in which the
secrets.json
file wasn't found, and they hadDJANGOPROJECT_DATA_DIR
env var set (but thesecrets.json
was on a different directory).The instructions tell you to have this on your bashrc/zshrc export
DJANGOPROJECT_DATA_DIR=~/.djangoproject
, and if set, expect a~/.djangoproject/conf/secrets.json
.In fact there's a fallback for that but only in the env variable is not set, which the instructions never tell you about.
Removing the
DJANGOPROJECT_DATA_DIR
would require coordination with operations to make sure it doesn't break their setup, so for now I'd just make it error explicitly if thesecrets.json
file is not found, which is a good initial step.I think there's a case in which this breaks an existing working local setup, which requires the following conditions:
DJANGOPROJECT_DATA_DIR
is set to a path that doesn't containsecrets.json
. Note that the website can work withoutDJANGOPROJECT_DATA_DIR
being set at all.DATABASES
. Any difference will mean it will raise an error when trying to execute Django.