Organize Django settings into multiple files and directories. Easily override and modify settings. Use wildcards and optional settings files.

Overview

django-split-settings logo


wemake.services test codecov Docs Python Version wemake-python-styleguide

Organize Django settings into multiple files and directories. Easily override and modify settings. Use wildcards in settings file paths and mark settings files as optional.

Read this blog post for more information. Also, check this example project.

Requirements

While this package will most likely work with the most versions of django, we officially support:

  • 1.11
  • 2.2
  • 3.0
  • 3.1

This package has no dependencies itself.

In case you need older python / django versions support, then consider using older versions of django-split-settings.

Installation

pip install django-split-settings

Usage

Replace your existing settings.py with a list of components that make up your Django settings. Preferably create a settings package that contains all the files.

Here's a minimal example:

from split_settings.tools import optional, include

include(
    'components/base.py',
    'components/database.py',
    optional('local_settings.py')
)

In the example, the files base.py and database.py are included in that order from the subdirectory called components/. local_settings.py in the same directory is included if it exists.

Note: The local context is passed on to each file, so each following file can access and modify the settings declared in the previous files.

We also made an in-depth tutorial.

Tips and tricks

You can use wildcards in file paths:

include('components/my_app/*.py')

Note that files are included in the order that glob returns them, probably in the same order as what ls -U would list them. The files are NOT in alphabetical order.

You can modify common settings in environment settings simply importing them

# local_settings.py
from components.base import INSTALLED_APPS

INSTALLED_APPS += (
  'raven.contrib.django.raven_compat',
)

Do you want to contribute?

Read the CONTRIBUTING.md file.

Version history

See CHANGELOG.md file.

Comments
  • Version 0.2.3 improvements.

    Version 0.2.3 improvements.

    Hi team,

    Thank you for your time, you created nice stuff which I had too, but my version was not "plug-and-play", so I spent some time to add functionality and tests to your library. I hope you like it! :)

    Please take a look my changes, approve it, merge and publish new version to allow me use it right now! :)

    0.2.3

    • Now include function finds parent globals() scope automatically
    • added protection against infinite recursion with tests
    • added tests for stackable settings definition. Check settings example in tests/settings/stacked/.

    Thanks for your time.

    opened by phpdude 13
  • Include an absolute path file.

    Include an absolute path file.

    I've been checking the code and it doesn't seem possible to include a file with absolute path. Is there any alternative in this regard ?

    The code always gathers the file paths relative to the settings it calls include.

    pattern = os.path.join(conf_path, conf_file)

    question 
    opened by alexsilva 8
  • Python 3.8 support

    Python 3.8 support

    Does it support Python 3.8? If it does, why not add 3.8 to Travis's config? Or, maybe because of wemake-style-guide?

    I can work on it if you think that we need this. Thanks.

    question 
    opened by lk-geimfari 8
  • Bump django from 2.2.8 to 3.0.1

    Bump django from 2.2.8 to 3.0.1

    Bumps django from 2.2.8 to 3.0.1.

    Commits
    • 03d64f1 [3.0.x] Bumped version for 3.0.1 release.
    • 302a4ff [3.0.x] Fixed CVE-2019-19844 -- Used verified user email for password reset r...
    • 33d2cda [3.0.x] Doc'd HttpResponse.set_cookie()'s secure argument.
    • 3ab7de0 [3.0.x] Refs #6657 -- Corrected HttpResponse.set_cookie()/set_signed_cookie()...
    • 6cb3041 [3.0.x] Fixed #31069, Refs #26431 -- Doc'd RegexPattern behavior change in pa...
    • 79c92fc [3.0.x] Fixed typos in 3.0 release notes and docs/ref/request-response.txt.
    • f4baf2f [3.0.x] Refs #31073 -- Added release notes for 02eff7ef60466da108b1a33f1e4dc0...
    • 74e1454 [3.0.x] Fixed #31073 -- Prevented CheckboxInput.get_context() from mutating a...
    • 314cb3a [3.0.x] Fixed typo in docs/releases/3.0.1.txt.
    • 8af0771 [3.0.x] Fixed #31060 -- Reallowed window expressions to be used in conditions...
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language
    • @dependabot badge me will comment on this PR with code to add a "Dependabot enabled" badge to your readme

    Additionally, you can set the following in your Dependabot dashboard:

    • Update frequency (including time of day and day of week)
    • Pull request limits (per update run and/or open at any time)
    • Automerge options (never/patch/minor, and dev/runtime dependencies)
    • Out-of-range updates (receive only lockfile updates, if desired)
    • Security updates (receive only security updates, if desired)
    dependencies 
    opened by dependabot-preview[bot] 6
  • Bump sphinx from 2.4.4 to 3.0.4 in /docs

    Bump sphinx from 2.4.4 to 3.0.4 in /docs

    Bumps sphinx from 2.4.4 to 3.0.4.

    Changelog

    Sourced from sphinx's changelog.

    Release 3.0.4 (released May 27, 2020)

    Bugs fixed

    • #7567: autodoc: parametrized types are shown twice for generic types
    • #7637: autodoc: system defined TypeVars are shown in Python 3.9
    • #7696: html: Updated jQuery version from 3.4.1 to 3.5.1 for security reasons
    • #7611: md5 fails when OpenSSL FIPS is enabled
    • #7626: release package does not contain CODE_OF_CONDUCT

    Release 3.0.3 (released Apr 26, 2020)

    Features added

    • C, parse array declarators with static, qualifiers, and VLA specification.

    Bugs fixed

    • #7516: autodoc: crashes if target object raises an error on accessing its attributes

    Release 3.0.2 (released Apr 19, 2020)

    Features added

    • C, parse attributes and add :confval:c_id_attributes and :confval:c_paren_attributes to support user-defined attributes.

    Bugs fixed

    • #7461: py domain: fails with IndexError for empty tuple in type annotation
    • #7510: py domain: keyword-only arguments are documented as having a default of None
    • #7418: std domain: :rst:role:term role could not match case-insensitively
    • #7461: autodoc: empty tuple in type annotation is not shown correctly
    • #7479: autodoc: Sphinx builds has been slower since 3.0.0 on mocking
    • C++, fix spacing issue in east-const declarations.
    • #7414: LaTeX: Xindy language options were incorrect
    • sphinx crashes with ImportError on python3.5.1

    Release 3.0.1 (released Apr 11, 2020)

    ... (truncated)
    Commits
    • b797f7f Bump to 3.0.4 final
    • c1ef87a Fix #7696: html: Updated jQuery version from 3.4.1 to 3.5.1
    • f777ad3 Merge pull request #7638 from tk0miya/7626_missing_CODE_OF_CONDUCT
    • f732561 Merge pull request #7640 from tk0miya/suppress_system_defined_TypeVars
    • 1fbfb72 Suppress arguments if all system defined TypeVars on py39
    • cf5660c Fix #7626: release package does not contain CODE_OF_CONDUCT
    • d670214 Merge pull request #7614 from lhupfeldt/3.0.x
    • 7d41edd Introduce fips safe sha1, see issue #7611
    • 8bbc7b8 Rename fips_safe_md5 to md5
    • 193d141 Fix mypy and flake8 checks
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language
    • @dependabot badge me will comment on this PR with code to add a "Dependabot enabled" badge to your readme

    Additionally, you can set the following in your Dependabot dashboard:

    • Update frequency (including time of day and day of week)
    • Pull request limits (per update run and/or open at any time)
    • Automerge options (never/patch/minor, and dev/runtime dependencies)
    • Out-of-range updates (receive only lockfile updates, if desired)
    • Security updates (receive only security updates, if desired)
    dependencies 
    opened by dependabot-preview[bot] 5
  • Load globs in alhpebetical order to prevent undefined behavior

    Load globs in alhpebetical order to prevent undefined behavior

    Previously files were not sorted at all (using the order at which entries appear in the filesystem). With this approach every file needs to be capable of being loaded in any order- something I woudln't expect users to test for. Sorting files by name-order allows for index config files like 010-base.py and 030-secrets.py to load procedurally and deterministically, and reduces complexity when in use.

    opened by ghost 5
  • Error with unicode module names on Python2

    Error with unicode module names on Python2

    I maintain a Django installation and want to migrate the settings (lots of from X import *) to django-split-setings. Seems everything went fine, but the tox test for Python 2.7 (the only tested version < 3) bailed on me with the following error:

    Traceback (most recent call last):
      File ".tox/py27/bin/django-admin.py", line 5, in <module>
        management.execute_from_command_line()
      File "/home/…/source/.tox/py27/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
        utility.execute()
      File "/home/…/source/.tox/py27/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 302, in execute
        settings.INSTALLED_APPS
      File "/home/…/source/.tox/py27/local/lib/python2.7/site-packages/django/conf/__init__.py", line 55, in __getattr__
        self._setup(name)
      File "/home/…/source/.tox/py27/local/lib/python2.7/site-packages/django/conf/__init__.py", line 43, in _setup
        self._wrapped = Settings(settings_module)
      File "/home/…/source/.tox/py27/local/lib/python2.7/site-packages/django/conf/__init__.py", line 99, in __init__
        mod = importlib.import_module(self.SETTINGS_MODULE)
      File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
        __import__(name)
      File "/home/…/source/streambox/streambox/settings/test.py", line 19, in <module>
        scope=globals()
      File "/home/…/source/.tox/py27/local/lib/python2.7/site-packages/split_settings/tools.py", line 84, in include
        exec(compile(to_compile.read(), included_file, 'exec'), scope)
      File "/home/…/source/streambox/streambox/settings/components/base.py", line 147, in <module>
        scope=globals()
      File "/home/…/source/.tox/py27/local/lib/python2.7/site-packages/split_settings/tools.py", line 90, in include
        module = types.ModuleType(module_name)
    TypeError: module.__init__() argument 1 must be string, not unicode
    

    This might be a result of from __future__ import unicode_literals. Any ideas how to handle this?

    bug 
    opened by brutus 5
  • Bump sphinx-autodoc-typehints from 1.19.2 to 1.19.3 in /docs

    Bump sphinx-autodoc-typehints from 1.19.2 to 1.19.3 in /docs

    Bumps sphinx-autodoc-typehints from 1.19.2 to 1.19.3.

    Release notes

    Sourced from sphinx-autodoc-typehints's releases.

    1.19.3

    What's Changed

    Full Changelog: https://github.com/tox-dev/sphinx-autodoc-typehints/compare/1.19.2...1.19.3

    Changelog

    Sourced from sphinx-autodoc-typehints's changelog.

    Changelog

    1.20

    • Use hatchling instead of setuptools
    • Add support for typing.ParamSpec
    • Allow star prefixes for parameter names in docstring
    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies python 
    opened by dependabot[bot] 4
  • Bump sphinx from 5.1.1 to 5.2.1 in /docs

    Bump sphinx from 5.1.1 to 5.2.1 in /docs

    Bumps sphinx from 5.1.1 to 5.2.1.

    Release notes

    Sourced from sphinx's releases.

    v5.2.1

    Changelog: https://www.sphinx-doc.org/en/master/changes.html

    v5.2.0

    Changelog: https://www.sphinx-doc.org/en/master/changes.html

    Changelog

    Sourced from sphinx's changelog.

    Release 5.2.1 (released Sep 24, 2022)

    Bugs fixed

    • #10861: Always normalise the pycon3 lexer to pycon.
    • Fix using sphinx.ext.autosummary with modules containing titles in the module-level docstring.

    Release 5.2.0.post0 (released Sep 24, 2022)

    • Recreated source tarballs for Debian maintainers.

    Release 5.2.0 (released Sep 24, 2022)

    Dependencies

    • #10356: Sphinx now uses declarative metadata with pyproject.toml to create packages, using PyPA's flit project as a build backend. Patch by Adam Turner.

    Deprecated

    • #10843: Support for HTML 4 output. Patch by Adam Turner.

    Features added

    • #10738: napoleon: Add support for docstring types using 'of', like type of type. Example: tuple of int.
    • #10286: C++, support requires clauses not just between the template parameter lists and the declaration.
    • #10755: linkcheck: Check the source URL of raw directives that use the url option.
    • #10781: Allow :rst:role:ref role to be used with definitions and fields.
    • #10717: HTML Search: Increase priority for full title and subtitle matches in search results
    • #10718: HTML Search: Save search result score to the HTML element for debugging
    • #10673: Make toctree accept 'genindex', 'modindex' and 'search' docnames
    • #6316, #10804: Add domain objects to the table of contents. Patch by Adam Turner
    • #6692: HTML Search: Include explicit :rst:dir:index directive index entries in the search index and search results. Patch by Adam Turner
    • #10816: imgmath: Allow embedding images in HTML as base64
    • #10854: HTML Search: Use browser localstorage for highlight control, stop storing highlight parameters in URL query strings. Patch by Adam Turner.

    ... (truncated)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies python 
    opened by dependabot[bot] 4
  • Bump sphinx from 3.5.4 to 4.0.0

    Bump sphinx from 3.5.4 to 4.0.0

    Bumps sphinx from 3.5.4 to 4.0.0.

    Changelog

    Sourced from sphinx's changelog.

    Release 4.0.0 (released May 09, 2021)

    Dependencies

    4.0.0b1

    • Drop python 3.5 support
    • Drop docutils 0.12 and 0.13 support
    • LaTeX: add tex-gyre font dependency

    4.0.0b2

    • Support docutils-0.17. Please notice it changes the output of HTML builder. Some themes do not support it, and you need to update your custom CSS to upgrade it.

    Incompatible changes

    4.0.0b1

    • #8539: autodoc: info-field-list is generated into the class description when autodoc_typehints='description' and autoclass_content='class' set
    • #8898: extlinks: "%s" becomes required keyword in the link caption string
    • domain: The Index class becomes subclasses of abc.ABC to indicate methods that must be overrided in the concrete classes
    • #4826: py domain: The structure of python objects is changed. A boolean value is added to indicate that the python object is canonical one
    • #7425: MathJax: The MathJax was changed from 2 to 3. Users using a custom MathJax configuration may have to set the old MathJax path or update their configuration for version 3. See :mod:sphinx.ext.mathjax.
    • #7784: i18n: The msgid for alt text of image is changed
    • #5560: napoleon: :confval:napoleon_use_param also affect "other parameters" section
    • #7996: manpage: Make a section directory on build manpage by default (see :confval:man_make_section_directory)
    • #7849: html: Change the default setting of :confval:html_codeblock_linenos_style to 'inline'
    • #8380: html search: search results are wrapped with <p> instead of <div>
    • html theme: Move a script tag for documentation_options.js in basic/layout.html to script_files variable
    • html theme: Move CSS tags in basic/layout.html to css_files variable
    • #8915: html theme: Emit a warning for sphinx_rtd_theme-0.2.4 or older
    • #8508: LaTeX: uplatex becomes a default setting of latex_engine for Japanese documents
    • #5977: py domain: :var:, :cvar: and :ivar: fields do not create cross-references

    ... (truncated)

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.

    If all status checks pass Dependabot will automatically merge this pull request.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language
    • @dependabot badge me will comment on this PR with code to add a "Dependabot enabled" badge to your readme

    Additionally, you can set the following in your Dependabot dashboard:

    • Update frequency (including time of day and day of week)
    • Pull request limits (per update run and/or open at any time)
    • Automerge options (never/patch/minor, and dev/runtime dependencies)
    • Out-of-range updates (receive only lockfile updates, if desired)
    • Security updates (receive only security updates, if desired)
    dependencies 
    opened by dependabot-preview[bot] 4
  • Bump pytest from 5.3.5 to 5.4.1

    Bump pytest from 5.3.5 to 5.4.1

    Bumps pytest from 5.3.5 to 5.4.1.

    Release notes

    Sourced from pytest's releases.

    5.4.1

    pytest 5.4.1 (2020-03-13)

    Bug Fixes

    • #6909: Revert the change introduced by #6330, which required all arguments to @pytest.mark.parametrize to be explicitly defined in the function signature.

      The intention of the original change was to remove what was expected to be an unintended/surprising behavior, but it turns out many people relied on it, so the restriction has been reverted.

    • #6910: Fix crash when plugins return an unknown stats while using the --reportlog option.

    pytest 5.4.0 (2020-03-12)

    Breaking Changes

    • #6316: Matching of -k EXPRESSION to test names is now case-insensitive.

    • #6443: Plugins specified with -p are now loaded after internal plugins, which results in their hooks being called before the internal ones.

      This makes the -p behavior consistent with PYTEST_PLUGINS.

    • #6637: Removed the long-deprecated pytest_itemstart hook.

      This hook has been marked as deprecated and not been even called by pytest for over 10 years now.

    • #6673: Reversed / fix meaning of "+/-" in error diffs. "-" means that sth. expected is missing in the result and "+" means that there are unexpected extras in the result.

    • #6737: The cached_result attribute of FixtureDef is now set to None when the result is unavailable, instead of being deleted.

      If your plugin performs checks like hasattr(fixturedef, 'cached_result'), for example in a pytest_fixture_post_finalizer hook implementation, replace it with fixturedef.cached_result is not None. If you del the attribute, set it to None instead.

    Deprecations

    • #3238: Option --no-print-logs is deprecated and meant to be removed in a future release. If you use --no-print-logs, please try out --show-capture and provide feedback.

      --show-capture command-line option was added in pytest 3.5.0 and allows to specify how to display captured output when tests fail: no, stdout, stderr, log or all (the default).

    • #571: Deprecate the unused/broken [pytest_collect_directory]{.title-ref} hook. It was misaligned since the removal of the Directory collector in 2010 and incorrect/unusable as soon as collection was split from test execution.

    ... (truncated)
    Changelog

    Sourced from pytest's changelog.

    Commits
    • 3d0f3ba Preparing release version 5.4.1
    • b9e2cd0 Merge pull request #6914 from nicoddemus/revert-6330
    • a84fcbf Revert "[parametrize] enforce explicit argnames declaration (#6330)"
    • 59c1bfa Merge pull request #6913 from nicoddemus/backport-6910
    • 3267f64 Merge pull request #6910 from nicoddemus/resultlog-logreport
    • c9fd1bd Preparing release version 5.4.0
    • 93aa988 Merge pull request #6901 from RonnyPfannschmidt/regendoc-fix-simple
    • 7996724 Merge pull request #6902 from RoyalTS/filterwarnings-docfix
    • 90ee8a7 docfix
    • 378a75d run and fix tox -e regen to prepare 5.4
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language
    • @dependabot badge me will comment on this PR with code to add a "Dependabot enabled" badge to your readme

    Additionally, you can set the following in your Dependabot dashboard:

    • Update frequency (including time of day and day of week)
    • Pull request limits (per update run and/or open at any time)
    • Automerge options (never/patch/minor, and dev/runtime dependencies)
    • Out-of-range updates (receive only lockfile updates, if desired)
    • Security updates (receive only security updates, if desired)
    dependencies 
    opened by dependabot-preview[bot] 4
  • Enable pylint and autocomplete support for IDEs

    Enable pylint and autocomplete support for IDEs

    Hi,

    after switching to django-split-settings, and setting up the project with examples supplied in the documentation I have a problem, because my pylint configuration is complaining about missing attributes inside settings module:

    ************* Module xxx
    xxx.py:114:23: E1101: Module 'project.settings' has no 'DEBUG' member (no-member)
    

    I also don't have autocomplete within PyCharm/VSCode.

    Anything that I can do to import all of the settings when checking the code?

    Here is my init.py inside settings module:

    """
    This is a django-split-settings main file.
    For more information read this:
    https://github.com/sobolevn/django-split-settings
    Default environment is `developement`.
    To change settings file:
    `DJANGO_ENV=production python manage.py runserver`
    """
    from os import environ
    
    from split_settings.tools import include
    from split_settings.tools import optional
    
    ENV = environ.get("DJANGO_ENV") or "development"
    
    base_settings = [
        "components/django.py",
        "components/database.py",
        "components/emails.py",
        # Select the right env:
        f"environments/{ENV}.py",
        # Optionally override some settings:
        optional("environments/local.py"),
    ]
    
    # Include settings:
    include(*base_settings)
    

    Looking forward for a reply! Have a good day! :)

    opened by proapi 0
  • BASE_DIR is broken after implementing django-split-settings

    BASE_DIR is broken after implementing django-split-settings

    There should be a mention in the documentation that you have to update the BASE_DIR constant in order for language, media and static folders to work.

    A crude workaround is to update the path from: BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(file))) to BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(file))))

    opened by Reve 2
  • path info according to `__file__`

    path info according to `__file__`

    Hi,

    Above all, thank you for sharing this great package. I have a setting according to the __file__, but the file location is not based on the file itself, but the include calling file. For example, when I have setting files as:

    settings.__init__.py
    settings/components/__init__.py
    settings/components/common.py
    settings/components/others.py
    

    and if assume that include is calling components/common.py that contains the __file__ based setting. I expected the __file__ == settings/components/common.py but the actual value is settings.__init__.py.

    if I have another setting in components/others.py and need to import from settings.components.common import VARS where the VARS is the setting based on __file__, then the value of the VARS becomes different.

    Can I have any hint to solve this conflict? Thank you!

    opened by jinserk 4
  • Issue 195

    Issue 195

    This PR is to merge in modifications to support the functionality described in issue 195. All changes are 100% backwards compatible. I've added two new test cases to validate the resource inclusion and alternate extensions. All tests pass on python 3.6-3.8 and there are no mypy or flake8 linting flags.

    The basic strategy was to create a _Resource class that extends from str like _Option. This class serves as a thin wrapper over the new importlib_resources library calls. The path of the resource is set as the string. The one thing to note is that if the package containing the resources being imported is archived then importlib_resources will create a temporary file to read from. This file is cleaned up at the end of the include call.

    The idea was to have resource files run through basically the same execution path as normal files to reduce the chance of bugs. The normal file execution code path is minimally touched to reduce the chances of any non-backwards compatibilities.

    opened by bckohan 1
  • Allow packaged resources and alternate extensions

    Allow packaged resources and alternate extensions

    Thanks for a great utility. It's kept my Django settings sane for a few years now.

    I manage several large Django projects with many apps that are deployed in multiple settings, each time having a different INSTALLED_APP stack. A pattern I've found immensely useful in this scenario is for my constituent app packages to include default settings files as packaged resources. I give them alternate extensions (i.e. .conf instead of .py) so my system knows which ones to automagically include.

    I've been using an extended version of django-split-settings to accomplish this, but I think others could find this useful as well so I'm happy to submit my extensions as a PR.

    For example, the idea is to be able to include packaged resources where your directory structure looks like:

    mypackage
    ├── __init__.py
    └── settings
        ├── __init__.py
        └── base.conf
    

    As so:

    from split_settings import include, resource, optional
    from mypackage import settings
    
    include(
        resource(settings, 'base.conf'),
        resource('mypackage.settings', 'base.conf'),  # alternate
        optional(resource(settings, 'local.conf')),  # optional can wrap resources too
    )
    

    Another nicety about using an alternate to .py for your settings files is that its a visual cue to other devs (and your IDE) that these files may not behave like typical python files on account of how split-settings sets their scope.

    opened by bckohan 0
Releases(1.2.0)
  • 1.2.0(Sep 27, 2022)

  • 1.1.0(Nov 17, 2020)

  • 1.0.1(Apr 22, 2020)

  • 1.0.0(Sep 15, 2019)

    Breaking changes:

    • Drops python2 support
    • Drops django2.0 support

    Improvements:

    • Moves to poetry
    • Adds mypy support
    • Adds wemake-python-styleguide support
    • Adds extra CI checks: safety, doc8
    • Adds py.typed file to package type information
    Source code(tar.gz)
    Source code(zip)
  • v0.3.0(Dec 4, 2017)

    Improvements:

    • Added Django==2.0
    • Removed old versions of Django from test matrix
    • Removed python3.4 from test matrix
    • Documentation updates
    • Adds more flake8 plugins to enforce strict style

    Bugs:

    • Fixes Windows problems via #21
    Source code(tar.gz)
    Source code(zip)
  • v0.2.5(Apr 18, 2017)

    Verison 0.2.5

    This version does not bring any new features. Only documentation updates and improvements.

    Improvements:

    • Added python3.6 and Django==1.11
    • Fixed tests/settings structure with basic/ folder
    • Added documentation, which is built with Sphinx
    • Updated README.rst with new logo
    • Updated README.rst with docs badge
    • Updated CONTRIBUTING.rst with new information

    Bugs:

    • Updated README.rst to be compatible with PyPI
    Source code(tar.gz)
    Source code(zip)
Dynamic Django settings.

Constance - Dynamic Django settings A Django app for storing dynamic settings in pluggable backends (Redis and Django model backend built in) with an

Jazzband 1.5k Jan 4, 2023
A helper for organizing Django project settings by relying on well established programming patterns.

django-configurations django-configurations eases Django project configuration by relying on the composability of Python classes. It extends the notio

Jazzband 955 Jan 5, 2023
Load Django Settings from Environmental Variables with One Magical Line of Code

DjEnv: Django + Environment Load Django Settings Directly from Environmental Variables features modify django configuration without modifying source c

Daniel J. Dufour 28 Oct 1, 2022
Read configuration settings from python configuration files.

Maison Read configuration settings from python configuration files. Motivation When developing a python application, e.g a command-line tool, it can b

null 9 Jan 4, 2023
A tool to manage configuration files, build scripts etc. across multiple projects.

A tool to manage configuration files, build scripts etc. across multiple projects.

null 8 Dec 14, 2022
Django-environ allows you to utilize 12factor inspired environment variables to configure your Django application.

Django-environ django-environ allows you to use Twelve-factor methodology to configure your Django application with environment variables. import envi

Daniele Faraglia 2.7k Jan 3, 2023
🤫 Easily manage configs and secrets in your Python projects (with CLI support)

Installation pip install confidential How does it work? Confidential manages secrets for your project, using AWS Secrets Manager. First, store a secr

Candid™️ 63 Oct 30, 2022
Inject your config variables into methods, so they are as close to usage as possible

Inject your config variables into methods, so they are as close to usage as possible

GDWR 7 Dec 14, 2022
Secsie is a configuration language made for speed, beauty, and ease of use.

secsie-conf pip3 install secsie-conf Secsie is a configuration language parser for Python, made for speed and beauty. Instead of writing config files

Noah Broyles 3 Feb 19, 2022
Generate config files and qr codes for wireguard vpn

wireguard config generator for python Generate config files and qr codes for wireguard vpn You will need to install qrcode and pillow in python and yo

null 18 Dec 2, 2022
A Python library to parse PARI/GP configuration and header files

pari-utils A Python library to parse PARI/GP configuration and header files. This is mainly used in the code generation of https://github.com/sagemath

Sage Mathematical Software System 3 Sep 18, 2022
Config files for my GitHub profile.

Config files for my GitHub profile.

Lukas Sales 7 May 17, 2022
Python Marlin Configurator to make valid configuration files to be used to compile Marlin with.

marlin-configurator Concept originally imagined by The-EG using PowerShell Build Script for Marlin Configurations The purpose of this project is to pa

DevPeeps 2 Oct 9, 2021
Configuration Extractor for EXE4J PE files

EXE4J Configuration Extractor This script helps reverse engineering Portable Executable files created with EXE4J by extracting their configuration dat

Karsten Hahn 6 Jun 29, 2022
filetailor is a peer-based configuration management utility for plain-text files such as dotfiles.

filetailor filetailor is a peer-based configuration management utility for plain-text files (and directories) such as dotfiles. Files are backed up to

null 5 Dec 23, 2022
Config files for my GitHub profile.

Hacked This is a python base script from which you can hack or clone any person's facebook friendlist or followers accounts which have simple password

null 2 Dec 10, 2021
Apt2sbom python package generates SPDX or YAML files

Welcome to apt2sbom This package contains a library and a CLI tool to convert a Ubuntu software package inventory to a software bill of materials. You

Eliot Lear 15 Nov 13, 2022
An application pulls configuration information from JSON files generated

AP Provisioning Automation An application pulls configuration information from JSON files generated by Ekahau and then uses Netmiko to configure the l

Cisco GVE DevNet Team 1 Dec 17, 2021
A set of Python scripts and notebooks to help administer and configure Workforce projects.

Workforce Scripts A set of Python scripts and notebooks to help administer and configure Workforce projects. Notebooks Several example Jupyter noteboo

Esri 75 Sep 9, 2022