torchbox / wagtail-template

A Django template for starting new Wagtail projects with Vagrant. NO LONGER MAINTANED
19 stars 8 forks source link

Support use_cdn, http_cache. #32

Open unixwitch opened 9 years ago

unixwitch commented 9 years ago
http_cache: if $CFG_CACHE_PURGE_URL is set, configure frontendcache to
purge pages on edit.  We ignore $CFG_CACHE_PURGE_BACKEND (hardcoding it
to HTTPBackend) because that's a project-specific setting, not a
property of the deployment environment.

$CFG_CACHE_PURGE_URL is always a full URL (not protocol-relative), but
beyond that the application shouldn't make any assumptions about its
content.  In particular, it may be either http or https.  Usually it
will be the same as the site URL, but that isn't guaranteed (for
example, under some Varnish configurations it might be http://localhost/,
but we're unlikely to deploy any more applications behind Varnish, in
favour of nginx).

use_cdn: honour environment variables for static and media locations:

- $CFG_STATIC_DIR
- $CFG_STATIC_URL
- $CFG_MEDIA_DIR
- $CFG_MEDIA_URL

Currently, we only set the $..._URL forms, not the $..._DIR forms, but
that will be changing soon as we move to NFS for media storage.

The URLs can have any form, but currently they're either relative URLs
(i.e., '/static/'), or protocol-relative URLs with a hostname, e.g.
'//d1e2lt5cd4cosj.cloudfront.net/tbxwagtail/static/'.  In either case
they will always end with a '/'.

In future this might change (for example, we might add a protocol), so
as with the cache purge URL, no assumptions should be made about their
format.