Skip to main content

A firefox-like about:config implementation for one-off settings in Django apps.

Project description

License: GPL v3 CI codecov PyPI version Openhub

A firefox-like about:config implementation for one-off settings in Django apps.

Compatible Python versions

3.6+

Compatible Django versions

2.0 - 3.0

Installation

You can install aboutconfig either from source or via pip:

pip install django-aboutconfig

The only thing you need to do to configure it is add it to your INSTALLED_APPS like all other django applications:

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    ...
    'aboutconfig',
]

Then just run manage.py migrate and you’re good to go.

Note: aboutconfig relies on having a good caching mechanism to be fast (all configured values are preloaded into cache on start-up). You should ideally have something like memcached configured to avoid slowdowns. See Django documentation for details.

Usage

By default, aboutconfig comes with four supported data-types: integer, boolean, string and decimal. All data types are configurable and you can add your own if necesessary.

To add some configuration values, head over to the django admin and add an instance of the Config model.

Having done this, you can access the configuration value via aboutconfig.get_config() in Python code or the get_config template filter (load config before using).

Python code:

from aboutconfig import get_config

def my_view(request):
    # some code...
    admin_email = get_config('admin.details.email')
    # some more code...

Template code:

{% load config %}

The website admin's email is {{ 'admin.details.email'|get_config }}.

>>> An assignment tag also exists for convenience:

{% get_config 'admin.details.email' as email %}
The website admin's email is <a href="mailto:{{ email }}">{{ email }}</a>.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-aboutconfig-1.1.0.tar.gz (24.1 kB view details)

Uploaded Source

Built Distribution

django_aboutconfig-1.1.0-py3-none-any.whl (19.3 kB view details)

Uploaded Python 3

File details

Details for the file django-aboutconfig-1.1.0.tar.gz.

File metadata

  • Download URL: django-aboutconfig-1.1.0.tar.gz
  • Upload date:
  • Size: 24.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.9

File hashes

Hashes for django-aboutconfig-1.1.0.tar.gz
Algorithm Hash digest
SHA256 ba52416113030c94a60f4525ed5115d7c9a17cd59d76cc88d53c6372c2dd0112
MD5 c2f2f155fd4ac04692378f360f23158e
BLAKE2b-256 60549db889308c6daa03fb7656743bedd43803a1243547dde3e3ea9f2a08e003

See more details on using hashes here.

File details

Details for the file django_aboutconfig-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: django_aboutconfig-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 19.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.9

File hashes

Hashes for django_aboutconfig-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 602e6f5f15cb29ee57e609e699f406f09be3e91dc582286f00ec25298bf805a6
MD5 e72da3c77bfce1696d343b7a0f45eb81
BLAKE2b-256 e9d9afc2f39f33c8c57b112890a2e70926ee2cfc45ae653088a34cf450668887

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page