適用於 Python 的 Azure Web Apps 程式庫Azure Web Apps libraries for Python

概觀Overview

使用 Azure App Service 來部署及調整網站、Web 應用程式、服務和 REST API。Deploy and scale websites, web applications, services, and REST APIs with Azure App Service.

若要開始使用 Azure App Service,請參閱在 Azure 中建立 Python Web 應用程式To get started with Azure App Service, see Create a Python web app in Azure.

管理 APIManagement API

使用管理 API 來部署、管理及調整裝載在 Azure App Service 中的元素。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 存放庫將 webapp 部署到 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.