Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

- Document filesystem caching for Chameleon page templates #461

Merged
merged 4 commits into from Jan 24, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGES.rst
Expand Up @@ -16,6 +16,12 @@ Fixes
- Don't error out when showing permissions for a non-existent user
(`#437 <https://github.com/zopefoundation/Zope/issues/437>`_)

Other changes
+++++++++++++

- Document filesystem caching for Chameleon page templates
(`#291 <https://github.com/zopefoundation/Zope/issues/291>`_)


4.0b8 (2018-12-14)
------------------
Expand Down
21 changes: 21 additions & 0 deletions docs/zope2book/AdvZPT.rst
Expand Up @@ -1202,6 +1202,27 @@ caching for performance-critical applications.
For more information on caching in the context of Zope, see the
chapter entitled `Zope Services <ZopeServices.html>`_.

Filesystem caching for Chameleon-based templates
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Zope 4 introduced the `Chameleon HTML/XML template engine
<https://chameleon.readthedocs.io/>`_ as new backend for Zope Page
Templates. The Chameleon templating engine can compile templates and
cache them on the file system for faster startup and execution.

File system caching is activated by setting an environment variable
named ``CHAMELEON_CACHE`` to the path of a folder on the filesystem
where Chameleon can write its compiled template representation.

Look for or add a section named ``environment`` in ``etc/wsgi.conf``
and add a suitable filesystem path, for example::

<environment>
icemac marked this conversation as resolved.
Show resolved Hide resolved
CHAMELEON_CACHE $INSTANCE/var
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, this will pollute /var with many, maybe hundreds of files. I'd prefer to suggest to use a separate directory. I know chameleon requires this directory to exist beforehand, maybe this could be documented, too.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@icemac I have changed the path to $INSTANCE/var/cache and added a note about creating that folder before starting Zope to the Zope Book chapter. Let me know what you think.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like it.

</environment>

How to configure Zope is explained in `Configuring Zope <../operation.html>`_.

Page Template Utilities
-----------------------

Expand Down
17 changes: 17 additions & 0 deletions src/Zope2/utilities/skel/etc/wsgi.conf.in
Expand Up @@ -35,6 +35,23 @@ instancehome $INSTANCE
# locale fr_FR


# Directive: environment
#
# Description:
# A section which can be used to define arbitrary key-value pairs
# for use as environment variables during Zope's run cycle. It
# is not recommended to set system-related environment variables such as
# PYTHONPATH within this section.
#
# Default: unset
#
# Example:
#
# <environment>
# CHAMELEON_CACHE $INSTANCE/var
# </environment>


# Directive: debug-mode
#
# Description:
Expand Down