Implement basic varnish purging

This allows all models inherited from PgModel to specify which
URLs to purge by either setting a field or defining a function
called purge_urls, at which point they will be purged whenever
the save signal is fired.

Also implements a form under /admin/purge/ that allows for manual
purging. This should probably be extended in the future to show
the status of the pgq slaves, but that will come later.

Includes a SQL function that posts the expires to a pgq queue. For
a local deployment, this can be replaced with a simple void function
to turn off varnish purging.
This commit is contained in:
Magnus Hagander
2011-06-14 19:48:48 +02:00
parent d9e26b9518
commit f92709d2a6
19 changed files with 181 additions and 24 deletions

View File

@ -36,6 +36,11 @@ class Version(models.Model):
class Meta:
ordering = ('-tree', )
def purge_urls(self):
yield '/$'
yield 'versions.rss'
# FIXME: probably a lot more?
class Country(models.Model):
name = models.CharField(max_length=100, null=False, blank=False)