A firefox-like about:config implementation for one-off settings in Django apps.
Project description
Django-Aboutconfig
==================
[![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](http://www.gnu.org/licenses/gpl-3.0)
[![Codeship](https://codeship.com/projects/49cf7540-11ab-0134-4d7f-228fbb5b3c99/status?branch=default)](https://codeship.com/projects/157317)
[![codecov](https://codecov.io/bb/impala/django-aboutconfig/branch/default/graph/badge.svg)](https://codecov.io/bb/impala/django-aboutconfig/branch/default)
[![PyPI version](https://badge.fury.io/py/django-aboutconfig.svg)](https://pypi.python.org/pypi/django-aboutconfig)
[![Openhub](https://www.openhub.net/p/django-aboutconfig/widgets/project_thin_badge.gif)](https://www.openhub.net/p/django-aboutconfig)
[![Dependency Status](https://www.versioneye.com/user/projects/575f31e17757a0003bd4c418/badge.svg?style=flat)](https://www.versioneye.com/user/projects/575f31e17757a0003bd4c418)
A firefox-like about:config implementation for one-off settings in Django apps.
#### Compatible Python versions
3.4+
#### Compatible Django versions
1.11, 2.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](https://docs.djangoproject.com/en/stable/topics/cache/).
## 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>.
==================
[![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](http://www.gnu.org/licenses/gpl-3.0)
[![Codeship](https://codeship.com/projects/49cf7540-11ab-0134-4d7f-228fbb5b3c99/status?branch=default)](https://codeship.com/projects/157317)
[![codecov](https://codecov.io/bb/impala/django-aboutconfig/branch/default/graph/badge.svg)](https://codecov.io/bb/impala/django-aboutconfig/branch/default)
[![PyPI version](https://badge.fury.io/py/django-aboutconfig.svg)](https://pypi.python.org/pypi/django-aboutconfig)
[![Openhub](https://www.openhub.net/p/django-aboutconfig/widgets/project_thin_badge.gif)](https://www.openhub.net/p/django-aboutconfig)
[![Dependency Status](https://www.versioneye.com/user/projects/575f31e17757a0003bd4c418/badge.svg?style=flat)](https://www.versioneye.com/user/projects/575f31e17757a0003bd4c418)
A firefox-like about:config implementation for one-off settings in Django apps.
#### Compatible Python versions
3.4+
#### Compatible Django versions
1.11, 2.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](https://docs.djangoproject.com/en/stable/topics/cache/).
## 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
Release history Release notifications | RSS feed
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-0.6.0.tar.gz
(24.7 kB
view hashes)
Built Distribution
Close
Hashes for django_aboutconfig-0.6.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9816bc1f0a730f1a5bb218a3e82a20475590ed6c78d559930e5f47f861b401cb |
|
MD5 | a453208daf123b2ee4ed1fb4d7069f7c |
|
BLAKE2b-256 | bcf63a1b9b5243b2f976ec39b97049eab0a1c20cd6cecfc9c414c1bbe335dcf1 |