From 47b4d3ee62dfdb830a83192907b0602218f9ab5e Mon Sep 17 00:00:00 2001 From: Chris McDonough Date: Fri, 3 Oct 2008 20:11:06 +0000 Subject: Docs - An "Environment and Configuration" chapter was added to the narrative portion of the documentation. Features - Ensure bfg doesn't generate warnings when running under Python 2.6. - The environment variable ``BFG_RELOAD_TEMPLATES`` is now available (serves the same purpose as ``reload_templates`` in the config file). - A new configuration file option ``debug_authorization`` was added. This turns on printing of security authorization debug statements to ``sys.stderr``. The ``BFG_DEBUG_AUTHORIZATION`` environment variable was also added; this performs the same duty. Bug Fixes - The environment variable ``BFG_SECURITY_DEBUG`` did not always work. It has been renamed to ``BFG_DEBUG_AUTHORIZATION`` and fixed. Deprecations - A deprecation warning is now issued when old API names from the ``repoze.bfg.templates`` module are imported. Backwards incompatibilities - The ``BFG_SECURITY_DEBUG`` environment variable was renamed to ``BFG_DEBUG_AUTHORIZATION``. --- docs/narr/templates.rst | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) (limited to 'docs/narr/templates.rst') diff --git a/docs/narr/templates.rst b/docs/narr/templates.rst index dce66ae3d..4878e728c 100644 --- a/docs/narr/templates.rst +++ b/docs/narr/templates.rst @@ -104,6 +104,38 @@ You can also pass XSLT parameters in as keyword arguments: This would then assign 'app1' as the value of an ```` parameter in the XSLT template. +.. _reload_templates_section: + +Automatically Reloading Templates +--------------------------------- + +It's often convenient to see changes you make to a template file +appear immediately without needing to restart the application process. +:mod:`repoze.bfg` allows you configure your application development +environment so that a change to a template will be automatically +detected, and the template will be reloaded on the next rendering. + +.. warning:: auto-template-reload behavior is not recommended for + production sites as it slows rendering; it's usually only + desirable during development. + +In order to turn on automatic reloading of templates, you can use an +environment variable setting or a configuration file setting. + +To use an environment variable, start your application under a shell +using the ``BFG_RELOAD_TEMPLATES`` environment variable set to ``1``, +For example:: + + $ BFG_RELOAD_TEMPLATES=1 bin/paster serve myproject.ini + +To use a setting in the the application ``.ini`` file for the same +purpose, set the ``reload_templates`` key to ``true`` within the +application's configuration section, e.g.:: + + [app:main] + use = egg:MyProject#app + reload_templates = true + Templating with other Templating Languages ------------------------------------------ @@ -138,4 +170,6 @@ installed, here's an example of using Mako from within a :mod:`repoze.bfg`-style bindings for the `Jinja2 `_ templating system. - +Note that if you use third-party templating languages, the +auto-template-reload strategy explained in +:ref:`reload_templates_section` will not be available. -- cgit v1.2.3