Log in

Using static URLs with ExtFile/ExtImage

We can use Apache to serve ExtFiles and ExtImages directly from the repository, without involving Zope. All we need to do is set the EXTFILE_STATIC_PATH environment variable in the <environment> section of etc/zope.conf.

EXTFILE_STATIC_PATH specifies the path Apache can use to access the repository. This depends on your virtual host configuration (see below).

If EXTFILE_STATIC_PATH is set, ExtFile enters static-mode. This means that the tag, link, and preview APIs of ExtFile and ExImage will generate static URLs, i.e. URLs that point to Apache, not back to Zope.

There is one quirk: The absolute_url API always returns the URL of the ZODB object, even in static-mode. ExtFiles have a separate static_url API, which you must use in place of absolute_url should you need to construct things like <img> or <a> tags by hand. It's best to leave the work to tag, link, and friends though.

Note that repository files must have file extensions for Apache to get the MIME headers right! ExtFile can help you here - and in fact does so by default. See the extensions option in extfile.ini.

Copyright (c) 2011 Zope Foundation. All rights reserved.
Legal | Contact
If you can read this text, it means you are not experiencing the Plone design at its best.
Plone makes heavy use of CSS, which means it is accessible to any internet browser,
but the design needs a
standards-compliant browser to look like we intended it.
Just so you know ;)