August 2016
Beginner to intermediate
717 pages
15h 24m
English
Each Django project has its configuration set in the conf/base.py or settings.py settings file. Some of these configuration values also need to be set in JavaScript. As we want a single location to define our project settings, and we don't want to repeat the process when setting the configuration for the JavaScript values, it is a good practice to include a dynamically generated configuration file in the base template. In this recipe, we will see how to do that.
Make sure that you have the media, static, and request context processors set in the TEMPLATE_CONTEXT_PROCESSORS setting, as follows:
# conf/base.py or settings.py TEMPLATE_CONTEXT_PROCESSORS = ( "django.contrib.auth.context_processors.auth", "django.core.context_processors.debug", ...Read now
Unlock full access