Package: armstrong.esi
Django application for handlingedge side include (ESI)UsageESI 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:<html>
  <body>
    <esi:include "/esi/welcome-message" />
    ... the rest of the page ...
  </body>
</html>A smart proxy such asVarnishand the middleware included witharmstrong.esican 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-messagearmstrong.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 %}
<html>
  <body>
    {% esi welcome_message %}
    ... the rest of the page ...
  </body>
</html>This replaces our{% esi %}tag with a<esi:include>tag pointing to
the URL for that view.Using with VarnishVarnishintegrates 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 ESIThe template tag reads theDEBUGsettings value and if set toTruerenders 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 & ConfigurationYou can install the latest release ofarmstrong.esiusingpip:pip install armstrong.apps.articlesMake sure to addarmstrong.esito yourINSTALLED_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 yourMIDDLEWARE_CLASSES:'armstrong.esi.middleware.EsiMiddleware'ContributingCreate something awesome – make the code better, add some functionality,
whatever (this is the hardest part).Fork itCreate a topic branch to house your changesGet all of your commits in the new topic branchSubmit apull requestState of ProjectArmstrong is an open-source news platform that is freely available to any
organization.  It is the result of a collaboration between theTexas TribuneandBay Citizen, and a grant from theJohn S. and James L. Knight
Foundation.  The first release is scheduled for June, 2011.To follow development, be sure to join theGoogle Group.armstrong.apps.articlesis part of theArmstrongproject.  You’re
probably looking for that.LicenseCopyright 2011-2012 Bay Citizen and Texas TribuneLicensed 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 athttp://www.apache.org/licenses/LICENSE-2.0Unless 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.