Package: wagtail-azure-cdn
An Azure CDN or Front Door backend for Wagtail’sfront-end cache invalidator.This module requiresazure-mgmt-cdnas minimum to work properly with Azure CDN.This module requiresazure-mgmt-frontdooras minimum to work properly with Azure Front Door.Installationpipinstallwagtail-azure-cdnYou can also install with dependencies. For Azure CDN support:pipinstallwagtail-azure-cdn[cdn]Or for Front Door support:pipinstallwagtail-azure-cdn[frontdoor]Or for both:pipinstallwagtail-azure-cdn[cdn,frontdoor]Configuration for Azure CDNAdd the following settings to your Wagtail project.fromazure.common.credentialsimportget_azure_cli_credentialsWAGTAILFRONTENDCACHE={"default":{"BACKEND":"wagtail_azure_cdn.backends.AzureCdnBackend","RESOURCE_GROUP_NAME":"Your resource group name","CDN_PROFILE_NAME":"Your CDN profile name","SUBSCRIPTION_ID":"Your subscription ID","CDN_ENDPOINT_NAME":"Your endpoint name","CREDENTIALS":get_azure_cli_credentials()[0]}}RESOURCE_GROUP_NAME,CDN_PROFILE_NAME,SUBSCRIPTION_IDandCDN_ENDPOINT_NAMEcan be all obtained from the Azure portal.CREDENTIALSis Azure credentials objects. They may be a callable to.See
the documentationfor the details.Multiple sitesYou can set settings for multiple hosts using theSITESsetting , for
example:fromazure.common.credentialsimportget_azure_cli_credentialsWAGTAILFRONTENDCACHE={"default":{"BACKEND":"wagtail_azure_cdn.backends.AzureCdnBackend","SITES":{"torchbox.com":{"RESOURCE_GROUP_NAME":"Your resource group name","CDN_PROFILE_NAME":"Your CDN profile name","SUBSCRIPTION_ID":"Your subscription ID","CDN_ENDPOINT_NAME":"Your endpoint name","CREDENTIALS":get_azure_cli_credentials()[0],},},},}Settings set at the top level will be used if there’s no settings for a site.
E.g. you can do this:fromazure.common.credentialsimportget_azure_cli_credentialsWAGTAILFRONTENDCACHE={"default":{"BACKEND":"wagtail_azure_cdn.backends.AzureCdnBackend","RESOURCE_GROUP_NAME":"Your resource group name","CDN_PROFILE_NAME":"Your CDN profile name","SUBSCRIPTION_ID":"Your subscription ID","SITES":{"torchbox.com":{"CDN_ENDPOINT_NAME":"Your endpoint name","CREDENTIALS":get_azure_cli_credentials()[0]},"jobs.torchbox.com":{"CDN_ENDPOINT_NAME":"Your endpoint name","CREDENTIALS":get_azure_cli_credentials()[0]},},},}Configuration for Azure Front DoorAdd the following settings to your Wagtail project.fromazure.common.credentialsimportget_azure_cli_credentialsWAGTAILFRONTENDCACHE={"default":{"BACKEND":"wagtail_azure_cdn.backends.AzureFrontDoorBackend","RESOURCE_GROUP_NAME":"Your resource group name","FRONTDOOR_NAME":"Your Front Door name","SUBSCRIPTION_ID":"Your subscription ID","CREDENTIALS":get_azure_cli_credentials()[0]}}RESOURCE_GROUP_NAME,FRONTDOOR_NAMEandSUBSCRIPTION_IDcan be all
obtained from the Azure portal.CREDENTIALSis Azure credentials objects. They may be a callable to.See
the documentationfor the details.Multi-site configurationThe multi-site configuration works the same for the Front Door, just useSITES.fromazure.common.credentialsimportget_azure_cli_credentialsWAGTAILFRONTENDCACHE={"default":{"BACKEND":"wagtail_azure_cdn.backends.AzureFrontDoorBackend","SITES":{"torchbox.com":{"RESOURCE_GROUP_NAME":"Your resource group name","FRONTDOOR_NAME":"Your Front Door name","SUBSCRIPTION_ID":"Your subscription ID","CREDENTIALS":get_azure_cli_credentials()[0],},},},}