Skip to main content

Utilities to help development of sites that utilize Edge Side Includes

Project description

Django application for handling edge side include (ESI)


ESI allows you to specify sections of the site that require different caching strategies and can be sent to a smart caching layer for rendering.

For example, if you want to send a page that is identical for every user except for a welcome message, you could render that message like:

    <esi:include "/esi/welcome-message" />
    ... the rest of the page ...

A smart proxy such as Varnish and the middleware included with armstrong.esi can cache this page, and send a request for /esi/welcome-message for personalization. The next user hitting the page would get the cached version and your application server would only need to render /esi/welcome-message

armstrong.esi provides a template tag for rendering the correct urls with the same syntax as django’s url tag. For example, the above example becomes:

{% load esi %}
    {% esi welcome_message %}
    ... the rest of the page ...

This replaces our {% esi %} tag with a <esi:include> tag pointing to the URL for that view.

Using with Varnish

Varnish integrates fairly easily with armstrong.esi. The EsiHeaderMiddleware sets the ‘X-ESI’ header to ‘true’ if the page request has esi tags on it. To enable esi processing in varnish for pages that need it, add the following to your vcl_fetch method:

if (beresp.http.X-ESI) {
    set beresp.do_esi = true;

Loading without ESI

The template tag reads the DEBUG settings value and if set to True renders the view with the current request rather than including the <esi:include> tag. This makes it easy to see fully rendered pages in development.

Installation & Configuration

You can install the latest release of armstrong.esi using pip:

pip install armstrong.apps.articles

Make sure to add armstrong.esi to your INSTALLED_APPS. You can add this however you like. This works as a copy-and-paste solution:

INSTALLED_APPS += ["armstrong.esi"]

You must also enable the armstrong.esi middleware. To do this, add the following line to your MIDDLEWARE_CLASSES:



  • Create something awesome – make the code better, add some functionality, whatever (this is the hardest part).
  • Fork it
  • Create a topic branch to house your changes
  • Get all of your commits in the new topic branch
  • Submit a pull request

State of Project

Armstrong is an open-source news platform that is freely available to any organization. It is the result of a collaboration between the Texas Tribune and Bay Citizen, and a grant from the John S. and James L. Knight Foundation. The first release is scheduled for June, 2011.

To follow development, be sure to join the Google Group.

armstrong.apps.articles is part of the Armstrong project. You’re probably looking for that.


Copyright 2011-2012 Bay Citizen and Texas Tribune

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

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 armstrong.esi, version 1.1.0
Filename, size File type Python version Upload date Hashes
Filename, size armstrong.esi-1.1.0.tar.gz (14.5 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page