将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_NAMECDN_PROFILE_NAMESUBSCRIPTION_IDCDN_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_NAMEFRONTDOOR_NAMESUBSCRIPTION_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],},},},}

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java在panelgrid中填充包含行和列的列表   Java中swing JList作为选项卡   java Zookeeper与spotify kafka图像的cprestproxy连接失败   java maven 3.0+跳过“mvn部署”上的插件执行   多线程在Java中,如何在同一网络上的服务器和客户端之间创建同步连接?   java Hibernate JPA“未找到关联类”,使用另一个实体作为键,可嵌入作为值   java在javamail api中用于会话的库   java活动生命周期回调混乱?   产生乱码输出的java if语句   java我无法从RESTAPI URL获取JSON对象   java如何在dropwizard中禁用cron作业   java公共静态工厂方法   java com。脸谱网。反应桥JavaJSExecutor$ProxyExecutor异常   Java中的安卓事件处理   java如何将p6spy与proxydatasource一起使用   使用JPQL时@Version的java行为   java不支持JDK7NIO。2在Linux上使用Epoll等?   使用Java Redis客户端(莴苣)连接到Amazon ElastiCache   在Java中将SQL Server的所有列中的一种数据类型更改为另一种数据类型   java在程序中删除抽象类的对象