適用於 Python 的 Azure Web Apps 程式庫

概觀

使用 Azure App Service 來部署及調整網站、Web 應用程式、服務和 REST API。

若要開始使用 Azure App Service,請參閱在 Azure 中建立 Python Web 應用程式

管理 API

使用管理 API 來部署、管理及調整裝載在 Azure App Service 中的元素。

透過 pip 安裝程式庫。

pip install azure-mgmt-web

範例

從 GitHub 存放庫將 webapp 部署到 Azure Web 應用程式。

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'
    )
)

範例

檢視 Web 應用程式範例的完整清單