mirror of https://github.com/zulip/zulip.git
dev_settings: Allow user to override settings in a git-ignored file.
This should make doing an ongoing development project related to a settings variant significantly more convenient.
This commit is contained in:
parent
2d1b217441
commit
a7c40748fd
|
@ -20,6 +20,7 @@
|
||||||
/zproject/apns-dev.pem
|
/zproject/apns-dev.pem
|
||||||
/zproject/apns-dev-key.p8
|
/zproject/apns-dev-key.p8
|
||||||
/zproject/dev-secrets.conf
|
/zproject/dev-secrets.conf
|
||||||
|
/zproject/custom_dev_settings.py
|
||||||
/tools/conf.ini
|
/tools/conf.ini
|
||||||
/tools/custom_provision
|
/tools/custom_provision
|
||||||
/tools/droplets/conf.ini
|
/tools/droplets/conf.ini
|
||||||
|
|
|
@ -110,6 +110,14 @@ additionally:
|
||||||
You can see a full list with `git grep development_only=True`, or
|
You can see a full list with `git grep development_only=True`, or
|
||||||
add additional settings of this form if needed.
|
add additional settings of this form if needed.
|
||||||
|
|
||||||
|
- If you need to override a setting in your development environment,
|
||||||
|
you can do so by creating a `zproject/custom_dev_settings.py`
|
||||||
|
setting the values you'd like to override (the test suites ignore
|
||||||
|
this file). This optional file is processed just after
|
||||||
|
`dev_settings.py` in `configured_settings.py`, so
|
||||||
|
`zproject/computed_settings.py` will correctly use your custom
|
||||||
|
settings when calculating any computed settings that depend on them.
|
||||||
|
|
||||||
- `zproject/test_settings.py` imports everything from
|
- `zproject/test_settings.py` imports everything from
|
||||||
`zproject/settings.py` and `zproject/test_extra_settings.py`.
|
`zproject/settings.py` and `zproject/test_extra_settings.py`.
|
||||||
|
|
||||||
|
|
|
@ -23,5 +23,21 @@ else:
|
||||||
from .prod_settings_template import * # noqa: F403 isort: skip
|
from .prod_settings_template import * # noqa: F403 isort: skip
|
||||||
from .dev_settings import * # noqa: F403 isort: skip
|
from .dev_settings import * # noqa: F403 isort: skip
|
||||||
|
|
||||||
|
# Support for local overrides to dev_settings.py is implemented here.
|
||||||
|
#
|
||||||
|
# We're careful to avoid those overrides applying to automated tests.
|
||||||
|
if not TEST_SUITE: # nocoverage
|
||||||
|
import contextlib
|
||||||
|
|
||||||
|
with contextlib.suppress(ImportError):
|
||||||
|
from zproject.custom_dev_settings import * # type: ignore[import, unused-ignore] # noqa: F403
|
||||||
|
|
||||||
|
# Print that we've got settings changes, so you know if you're testing non-base code.
|
||||||
|
#
|
||||||
|
# TODO: Figure out how to make this not be printed several
|
||||||
|
# times, and maybe print the actual keys that are
|
||||||
|
# overridden.
|
||||||
|
print("Using custom settings from zproject/custom_dev_settings.py.")
|
||||||
|
|
||||||
# Do not add any code after these wildcard imports! Add it to
|
# Do not add any code after these wildcard imports! Add it to
|
||||||
# computed_settings instead.
|
# computed_settings instead.
|
||||||
|
|
Loading…
Reference in New Issue