Skip to main content

Configurable Javascript settings in Django.

Project description

Configurable JavaScript settings in Django


Add 'settingsjs' to your INSTALLED_APPS (for the templates)
Include 'settingsjs.urls' in your urls.
Add a script tag with src="{% url settings_js %}"
<script type="text/javascript" src="{% url settings_js %}"></script>

Access the settings in JavaScript using Setting.get and Setting.get:

<script type="text/javascript">
var myapp_settings = Setting.get('myapp-settings');

Setting.set('some_key', 'some value');

Setting JavaScript settings

Use the SETTINGS_JS setting to specify settings:

'myapp-settings': {
"fu": "bar",

Use settingsjs.signals.collect_settings:

e.g. In a file that will always be loaded (such as a models or urls file).

from settingsjs.signals import collect_settings
from django.dispatch import receiver

def videos_settingsjs(sender, jssettings=None, **kwargs):
if jssettings is not None:
jssettings['myapp-settings'] = {
"fu": "bar",

Project details

Download files

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

Files for django-settingsjs, version 0.1.2
Filename, size File type Python version Upload date Hashes
Filename, size django-settingsjs-0.1.2.tar.gz (2.0 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page