-
Notifications
You must be signed in to change notification settings - Fork 601
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add a postdeploy step to purge surroage-keys for static files
- Loading branch information
Showing
4 changed files
with
15 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from django.core.management.base import BaseCommand | ||
from django.conf import settings | ||
|
||
from fastly.utils import purge_surrogate_key | ||
|
||
|
||
class Command(BaseCommand): | ||
""" Do things after deployment is complete """ | ||
|
||
def handle(self, *args, **kwargs): | ||
# If we have a STATIC_SURROGATE_KEY set, purge static files to ensure | ||
# that anything cached mid-deploy is ignored (like 404s). | ||
if settings.STATIC_SURROGATE_KEY: | ||
purge_surrogate_key(settings.STATIC_SURROGATE_KEY) |