你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

用于 Python 的 Azure Web 应用库Azure Web Apps libraries for Python

概述Overview

使用 Azure 应用服务部署和缩放网站、Web 应用程序、服务与 REST API。Deploy and scale websites, web applications, services, and REST APIs with Azure App Service.

若要开始使用 Azure 应用服务,请参阅在 Azure 中创建 Python Web 应用To get started with Azure App Service, see Create a Python web app in Azure.

管理 APIManagement API

使用管理 API 来部署、管理和缩放 Azure 应用服务中托管的元素。Deploy, manage, and scale elements hosted in the Azure App Service with the management API.

通过 pip 安装库。Install the library via pip.

pip install azure-mgmt-web

示例Example

将 GitHub 存储库中的 Web 应用部署到 Azure Web 应用。Deploy a webapp from a GitHub repository into Azure Web App.

siteConfiguration = SiteConfig(
    python_version='3.4'
)

# create a web app
web_client.web_apps.create_or_update(
    RESOURCE_GROUP_NAME,
    WEB_APP_NAME,
    Site(
        location='eastus',
        server_farm_id=SERVICE_PLAN_ID,
        site_config=siteConfiguration
    )
)

# continuous deployment with GitHub
source_control_async_operation = web_client.web_apps.create_or_update_source_control(
    RESOURCE_GROUP_NAME,
    WEB_APP_NAME,
    SiteSourceControl(
        location='GitHub',
        repo_url='https://github.com/lisawong19/python-docs-hello-world',
        branch='master'
    )
)

示例Samples

查看 Web 应用程序示例的完整列表View the complete list of web application samples.