Skip to main content

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.

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wagtail-azure-cdn-0.1a0.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

wagtail_azure_cdn-0.1a0-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file wagtail-azure-cdn-0.1a0.tar.gz.

File metadata

  • Download URL: wagtail-azure-cdn-0.1a0.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.2 pkginfo/1.4.2 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for wagtail-azure-cdn-0.1a0.tar.gz
Algorithm Hash digest
SHA256 64affd1588697c686c96e628cedb1b747d4f987ea46c292581485e957177914e
MD5 90c320114d8c853ab1b52164371e7bb8
BLAKE2b-256 aa08d1446aab8c7bbd596981e32d85110f8a42b49db9837a92889ebe812c8613

See more details on using hashes here.

Provenance

File details

Details for the file wagtail_azure_cdn-0.1a0-py3-none-any.whl.

File metadata

  • Download URL: wagtail_azure_cdn-0.1a0-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.2 pkginfo/1.4.2 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.4

File hashes

Hashes for wagtail_azure_cdn-0.1a0-py3-none-any.whl
Algorithm Hash digest
SHA256 66cf5f1802d32e8e76c9d6288b081ac5ab28de542e370d71a68379c7b71ffe8c
MD5 4849e669f95d1c4c352063b865553ba6
BLAKE2b-256 f8bf159cfd32374406ddd65eb25c7cd755cc0f1f8fd17a7d7fb4be804a7c69fd

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page