wagtail-azure-cdn
An Azure CDN or Front Door backend for Wagtail’s front-end cache invalidator.
This module requires azure-mgmt-cdn as minimum to work properly with Azure CDN.
This module requires azure-mgmt-frontdoor as minimum to work properly with Azure Front Door.
Installation
pip install wagtail-azure-cdn
You can also install with dependencies. For Azure CDN support:
pip install wagtail-azure-cdn[cdn]
Or for Front Door support:
pip install wagtail-azure-cdn[frontdoor]
Or for both:
pip install wagtail-azure-cdn[cdn,frontdoor]
Configuration for Azure CDN
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]
},
},
},
}
Configuration for Azure Front Door
Add the following settings to your Wagtail project.
from azure.common.credentials import get_azure_cli_credentials
WAGTAILFRONTENDCACHE = {
"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_NAME and SUBSCRIPTION_ID 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.
Multi-site configuration
The multi-site configuration works the same for the Front Door, just use SITES.
from azure.common.credentials import get_azure_cli_credentials
WAGTAILFRONTENDCACHE = {
"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],
},
},
},
}
Metadata
Release files for wagtail-azure-cdn 0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| wagtail-azure-cdn-0.3.tar.gz | 8.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| wagtail_azure_cdn-0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.2 kB
Release files / wagtail-azure-cdn-0.3.tar.gz
| Download URL | wagtail-azure-cdn-0.3.tar.gz |
|---|---|
| Size | 8.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3cbd30bd72b4fba0778a5f5bbf1fbc82c262ec7dcc56535188f8579f3b3866d8
|
|
BLAKE2b-256 checksum How to use checksums |
016aa7d82455808117f08192c50e6201fd748e0b7b46d27fca4985d07957ff58
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4
|
Release files / wagtail_azure_cdn-0.3-py3-none-any.whl
| Download URL | wagtail_azure_cdn-0.3-py3-none-any.whl |
|---|---|
| Size | 8.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bd645eeebae8287c86e1f16e6e67636f52d1aa55bd321142166038f1a5458074
|
|
BLAKE2b-256 checksum How to use checksums |
f50475b6cf3c73715084ef77007f69f16da3d16105c75ba5e3c3e4c9f3565ad6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4
|