Skip to main content

django-extraconfig

With django-extraconfig it’s easy to extend a Django project settings.py file. The only function provided by this module is load_extraconfig(entry_point_name, module_name).

extraconfig.load(entry_point_name, module_name)

Loads all uppercase values from the entry point modules into the module with the name module_name overriding any existing values.

Usage

At the bottom of your settings.py file add:

try:
    import extraconfig
except ImportError:
    pass
else:
    extraconfig.load(<entry_point_name>, __name__)

entry_point_name can be any string value but it’s a good practice to include the projectname in order to avoid name collisions. For example to load the extra configuration showed below, entry_point_name should be set to “my_project.extraconfig”.

Creating an extra configuration

It’s easy to create an extra configuration module. The minimal project layout is composed of two files: setup.py and the module file. The module will be installed using the setup.py file just like any other regular Python module. In order for django-extraconfig to know that this module should be used to override your Django configuration in setup.py you must add it in the entry point config.

A minimal setup.py file can look like this:

from setuptools import setup

setup(
    name='my_extra_config',
    version='0.1',
    py_modules=['my_extra_config'],
    entry_points = {
        'my_project.extraconfig': 'main = my_extra_config'
    }
)

Now you can add a my_extra_config.py file with the settings you want to override:

DEBUG = True

Installing the extra configuration

Once the extra configuration project is ready you can run:

python setup.py develop

This will install the extra configuration module in development mode, meaning you can edit the extra settings and all the changes will be visible without reinstalling it.

Metadata

Release files for django-extraconfig 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-extraconfig 0.1.1
File Size Uploaded Provenance Actions
django-extraconfig-0.1.1.tar.gz 2.1 kB Without provenance Details for django-extraconfig-0.1.1.tar.gz

Release files / django-extraconfig-0.1.1.tar.gz

Download URL django-extraconfig-0.1.1.tar.gz
Size 2.1 kB
Tags Source
SHA-256 checksum
How to use checksums
45db7666494ed749022566b4053d5caf302ebe033dcce7ba350e1855e1229f37
BLAKE2b-256 checksum
How to use checksums
13db909b9f86b9e1173fee96318efd532487399f4408b214a8531b7d7f624417
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for django-extraconfig 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page