将Azure CDN与Wagtail一起使用
wagtail-azure-cdn的Python项目详细描述
AzureCDN或Wagtail的前门后端 front-end cache invalidator。在
此模块至少需要azure-mgmt-cdn才能与Azure CDN正常工作。在
此模块至少需要azure-mgmt-frontdoor才能与Azure前门正常工作。在
安装
pip install wagtail-azure-cdn
也可以使用依赖项进行安装。对于Azure CDN支持:
^{pr2}$或前门支架:
pip install wagtail-azure-cdn[frontdoor]
或者两者兼而有之:
pip install wagtail-azure-cdn[cdn,frontdoor]
Azure CDN的配置
向Wagtail项目添加以下设置。在
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_ID和 CDN_ENDPOINT_NAME可以从Azure门户获得。在
- CREDENTIALS是Azure凭据对象。他们可能是一个可以召唤的人。See the documentation 了解详情。在
多个站点
您可以使用SITES设置为多个主机设置,对于 示例:
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],},},},}
如果站点没有设置,将使用在顶层设置的设置。 E、 g.你可以这样做:
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]},},},}
Azure前门配置
添加以下项目设置。在
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_NAME和SUBSCRIPTION_ID可以是全部 从Azure门户获取。在
- CREDENTIALS是Azure凭据对象。他们可能是一个可以召唤的人。See the documentation 了解详情。在
多站点配置
多站点配置对于前门也是一样的,只需使用站点。在
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],},},},}
- 项目
标签: