Skip to content
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

feat: dump_settings management command #36162

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kdmccormick
Copy link
Member

@kdmccormick kdmccormick commented Jan 23, 2025

Description

This command dumps the current Django settings to JSON for
debugging/diagnostics. The output of this command is for humans... it
is NOT suitable for consumption by production systems.

In particular, we are introducing this command as part of a series of
refactorings to the Django settings files lms/envs/* and cms/envs/*.
We want to ensure that these refactorings do not introduce any
unexpected breaking changes, so the dump_settings command will both help
us manually verify our refactorings and help operators verify that our
refactorings behave expectedly when using their custom python/yaml
settings files.

Supporting info

Example output: https://gist.github.com/kdmccormick/f13d087679ca6c3ba067f03bf58b7aa1

Related to: #36131

@kdmccormick kdmccormick force-pushed the kdmccormick/dump-settings branch 3 times, most recently from 6c7900c to c1fb2ea Compare January 24, 2025 17:08
@kdmccormick kdmccormick marked this pull request as ready for review January 24, 2025 17:09
@kdmccormick
Copy link
Member Author

Need to handle the DisableMigrations object:

FAILED openedx/core/djangoapps/util/tests/test_dump_settings.py::test_for_cms_settings - ValueError: Not sure how to dump value <pytest_django.fixtures._disable_migrations.<locals>.DisableMigrations object at 0x7fefea8e4050> of type <class 'pytest_django.fixtures._disable_migrations.<locals>.DisableMigrations'>

This command dumps the current Django settings to JSON for
debugging/diagnostics. The output of this command is for *humans*... it
is NOT suitable for consumption by production systems.

In particular, we are introducing this command as part of a series of
refactorings to the Django settings files lms/envs/* and cms/envs/*.
We want to ensure that these refactorings do not introduce any
unexpected breaking changes, so the dump_settings command will both help
us manually verify our refactorings and help operators verify that our
refactorings behave expectedly when using their custom python/yaml
settings files.

Part of: (TODO ADD LINK)
@kdmccormick kdmccormick force-pushed the kdmccormick/dump-settings branch from 1243025 to ed65cfa Compare January 24, 2025 23:27
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