Skip to content

feat(cl): add example for creating custom settings file #5860

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

florean
Copy link
Contributor

@florean florean commented Jul 1, 2025

There are file patterns for custom Django settings files in the .gitignore, but there are no examples or documentation for using them and it is not very discoverable. I added an example settings file with some documentation and a couple example settings that solve problems I have run into along with the corresponding line in the .env.dev.example file.

I also updated the wiki with documentation on using custom settings. Sorry, I thought it would create a PR or something, I did not know the changes would immediately go live. If this gets merged, it should be updated again (happy to do it).

There are file patterns for custom Django settings files in the `.gitignore`,
but there are no examples or documentation for using them and it is not very
discoverable.  I added an example settings file with some documentation and a
couple example settings that solve problems I have run into along with the
corresponding line in the `.env.dev.example` file.

I also updated the wiki with documentation on using custom settings.  Sorry, I
thought it would create a PR or something, I did not know the changes would
immediately go live.  If this gets merged, it should be updated again (happy to
do it).
@florean
Copy link
Contributor Author

florean commented Jul 1, 2025

Sorry about the wiki edit. Do you have a process for that? I can't believe GitHub still doesn't allow PRs against them. I can already see that I left off the Add your problem here... line.

@mlissner
Copy link
Member

mlissner commented Jul 2, 2025

Hm, thanks for doing this. I thought we could override settings just by tweaking values in the env file. I think you've got a solution that works, but it's sort of layered on top of the simpler solution we'd prefer. Did you try that?

@florean
Copy link
Contributor Author

florean commented Jul 2, 2025

I haven't dug into the documentation, but my assumption with django-environ was that it only overrides settings that have an explicit env call. We could add that to AWS_S3_CUSTOM_DOMAIN, but that doesn't help for cases like in my examples, such as modifying the CSP or a setting that takes a function. Basically any settings more complicated than a boolean or string.

I created these because I needed to modify settings (literally the examples I've included), but that is a pain when switching branches often. So I spent some time figuring out how to use a custom Django settings file with the project's setup and the final step was adding it to the .gitignore, which is when I discovered there was already a rule that covered this scenario. I've got everything I need and maybe nobody else needs custom settings, but I thought I'd contribute what would have saved me the most time in case someone does. If you have a simpler system that handles my use cases, then I'm happy to add some documentation for it, because I don't know what it is.

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.

2 participants