Use Azure CDN with Wagtail
Project description
An Azure CDN backend for Wagtail’s front-end cache invalidator.
This module requires azure-mgmt-cdn as minimum to work properly.
Installation
pip install wagtail-azure-cdn
Configuration
Add the following settings to your Wagtail project.
from azure.common.credentials import get_azure_cli_credentials
WAGTAILFRONTENDCACHE = {
"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_ID and CDN_ENDPOINT_NAME can be all obtained from the Azure portal.
CREDENTIALS is Azure credentials objects. They may be a callable to. See the documentation for the details.
Multiple sites
You can set settings for multiple hosts using the SITES setting , for example:
from azure.common.credentials import get_azure_cli_credentials
WAGTAILFRONTENDCACHE = {
"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:
from azure.common.credentials import get_azure_cli_credentials
WAGTAILFRONTENDCACHE = {
"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]
},
},
},
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for wagtail_azure_cdn-0.1a1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 027d91348fee8da72687c2f86a63d0082c9154acebe225ff60c2eaeb782b4465 |
|
MD5 | 79fda32a09b0ebe8e0ec91cf2351f1ca |
|
BLAKE2b-256 | 8cbfd510673375c66dd431a33a4dbbcc472d1aebdd102840bf9a0d0ae3c24420 |