繁体   English   中英

如何获取Azure Python Web应用进行部署

[英]How to get Azure Python web app to deploy

我无法使用Azure App Services部署简单的python脚本。 我试图先使用https://github.com/lakishadavid/test.git测试Web应用程序,然后再将其编辑为所需的python代码,但是使用此简单脚本进行的部署无法通过Azure App Service进行。

这些是我在Azure Cloud Shell中遵循的步骤:

创建名为DjangoServicePlan的应用程序服务计划

az appservice plan create -g MyDatabase_ResourceGroup -n DjangoServicePlan --is-linux --number-of-workers 1 --sku B1 -l "Central US"

创建应用服务

az webapp create --resource-group MyDatabase_ResourceGroup --plan DjangoServicePlan --name WebSiteName --runtime "PYTHON|3.7" --deployment-local-git

禁用ARR DjangoDemoAZ并强制HTTP,启用HTTP 2.0,禁用FTP部署功能和“始终在线”模式

az webapp update --name TAKiRCollectors --resource-group MyDatabase_ResourceGroup --client-affinity-enabled false --https-only true

az webapp config set --name TAKiRCollectors --resource-group MyDatabase_ResourceGroup  --http20-enabled  true --ftps-state Disabled --always-on false

定义环境变量

az webapp config appsettings set -g MyDatabase_ResourceGroup -n WebSiteName --settings DATABASE_NAME=mydatabase
az webapp config appsettings set -g MyDatabase_ResourceGroup -n WebSiteName --settings DATABASE_USER=lakishadavid@server
az webapp config appsettings set -g MyDatabase_ResourceGroup -n WebSiteName --settings DATABASE_PASSWORD=MyPassword
az webapp config appsettings set -g MyDatabase_ResourceGroup -n WebSiteName --settings DATABASE_HOST=server.postgres.database.azure.com
az webapp config appsettings set -g MyDatabase_ResourceGroup -n WebSiteName --settings DATABASE_PORT=5432

然后,我创建了一个目录并cd到该目录。 然后...

git clone https://github.com/lakishadavid/test.git
cd test
git remote add azure azure_url
git push azure master

即使我使用的是我设置的密码...

az webapp deployment user set --user-name MyUserName --password MyDeployPass1

...它告诉我身份验证失败。

快速入门有效,因此我认为问题出在部署或仅是python脚本中。 请指教。

Azure部署文档页面确实包括:

在Git Credential Manager窗口中,输入您的部署用户密码而不是 Azure登录密码。

因此,请确保您的Windows凭据管理器针对Azure URL包括Azure部署用户凭据,并包含:

  • 用户名在Azure中必须是唯一的,并且对于本地Git推送,用户名不得包含' @ '符号。
  • 密码必须至少八个字符长,并包含以下三个元素中的两个:字母,数字和符号。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM