【发布时间】:2021-04-04 01:14:16
【问题描述】:
我在 Microsoft Azure 上创建了一个 Web 应用程序并选择 Python 3.8 作为配置。
然后我在 Azure DevOps 上设置了一个部署管道,它将一个 django 应用程序部署到 Web 应用程序中。部署本身也运行良好,工件被复制和解压缩。但是要求的安装让我很难过。
在 Azure 门户上的 Web 应用程序的配置部分,我在常规设置中定义了“Python 3.8”。在 Azure DevOps 管道中,部署任务配置为使用“PYTHON|3.8”作为运行时堆栈。
但部署后操作仍然失败 - 这看起来是由执行任务的 Kundu 组件引起的,它本身正在运行 python 3.5 (python3) 和 python 2.7 (python)。
django 3.1.4 的 pip 安装失败并出现错误,我收到有关 python 3.5 生命周期结束的警告。
这是部署步骤及其完整输出
#Your build pipeline references an undefined variable named ‘Parameters.ConnectedServiceName’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab. See https://go.microsoft.com/fwlink/?linkid=865972
#Your build pipeline references an undefined variable named ‘Parameters.WebAppKind’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab. See https://go.microsoft.com/fwlink/?linkid=865972
#Your build pipeline references an undefined variable named ‘Parameters.WebAppName’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab. See https://go.microsoft.com/fwlink/?linkid=865972
#Your build pipeline references an undefined variable named ‘Parameters.StartupCommand’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab. See https://go.microsoft.com/fwlink/?linkid=865972
#Your build pipeline references an undefined variable named ‘Parameters.PythonAppFramework’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab. See https://go.microsoft.com/fwlink/?linkid=865972
steps:
- task: AzureRmWebAppDeployment@4
displayName: 'Deploy Azure App Service'
inputs:
azureSubscription: '$(Parameters.ConnectedServiceName)'
appType: '$(Parameters.WebAppKind)'
WebAppName: '$(Parameters.WebAppName)'
packageForLinux: '$(System.DefaultWorkingDirectory)/_xxx-CI/drop/xxx**.zip'
RuntimeStack: 'PYTHON|3.8'
StartupCommand: '$(Parameters.StartupCommand)'
ScriptType: 'Inline Script'
InlineScript: |
echo "Printing version of python3"
python3 --version
echo "Upgrading pip"
/usr/bin/python3 -m pip install --upgrade pip
echo "Installing requirements"
/usr/bin/python3 -m pip install -r xxx/requirements.txt
WebConfigParameters: '$(Parameters.PythonAppFramework)'
2020-12-26T14:52:34.2216420Z ##[section]Starting: Deploy Azure App Service
2020-12-26T14:52:34.2227205Z ==============================================================================
2020-12-26T14:52:34.2227775Z Task : Azure App Service deploy
2020-12-26T14:52:34.2228172Z Description : Deploy to Azure App Service a web, mobile, or API app using Docker, Java, .NET, .NET Core, Node.js, PHP, Python, or Ruby
2020-12-26T14:52:34.2228532Z Version : 4.179.0
2020-12-26T14:52:34.2228747Z Author : Microsoft Corporation
2020-12-26T14:52:34.2229021Z Help : https://aka.ms/azureappservicetroubleshooting
2020-12-26T14:52:34.2229517Z ==============================================================================
2020-12-26T14:52:35.2840047Z Got service connection details for Azure App Service:'xxx-dev'
2020-12-26T14:53:22.4215194Z Package deployment using ZIP Deploy initiated.
2020-12-26T14:54:12.3861589Z Deploy logs can be viewed at https://xxx-dev.scm.azurewebsites.net/api/deployments/b87f0b8e9bee48e6a823e1ef681812dd/log
2020-12-26T14:54:12.3866079Z Successfully deployed web package to App Service.
2020-12-26T14:54:13.3092961Z Trying to update App Service Application settings. Data: {"SCM_COMMAND_IDLE_TIMEOUT":"1800"}
2020-12-26T14:54:13.3105380Z App Service Application settings are already present.
2020-12-26T14:54:13.5984663Z Executing given script on Kudu service.
2020-12-26T14:54:33.9532357Z Standard output from script:
2020-12-26T14:54:33.9534448Z Printing version of python3
2020-12-26T14:54:33.9534739Z Python 3.5.3
2020-12-26T14:54:33.9534967Z Upgrading pip
2020-12-26T14:54:33.9535578Z Defaulting to user installation because normal site-packages is not writeable
2020-12-26T14:54:33.9536860Z Requirement already satisfied: pip in /home/.local/lib/python3.5/site-packages (20.3.3)
2020-12-26T14:54:33.9537372Z Installing requirements
2020-12-26T14:54:33.9537892Z Defaulting to user installation because normal site-packages is not writeable
2020-12-26T14:54:33.9538291Z Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
2020-12-26T14:54:33.9538602Z
2020-12-26T14:54:33.9544250Z Standard error from script:
2020-12-26T14:54:33.9593269Z ##[error]DEPRECATION: Python 3.5 reached the end of its life on September 13th, 2020. Please upgrade your Python as Python 3.5 is no longer maintained. pip 21.0 will drop support for Python 3.5 in January 2021. pip 21.0 will remove support for this functionality.
DEPRECATION: Python 3.5 reached the end of its life on September 13th, 2020. Please upgrade your Python as Python 3.5 is no longer maintained. pip 21.0 will drop support for Python 3.5 in January 2021. pip 21.0 will remove support for this functionality.
ERROR: Could not find a version that satisfies the requirement django==3.1.4
ERROR: No matching distribution found for django==3.1.4
2020-12-26T14:54:34.7576240Z ##[error]Error: Unable to run the script on Kudu Service. Error: Error: Executed script returned '1' as return code. Error: DEPRECATION: Python 3.5 reached the end of its life on September 13th, 2020. Please upgrade your Python as Python 3.5 is no longer maintained. pip 21.0 will drop support for Python 3.5 in January 2021. pip 21.0 will remove support for this functionality.
DEPRECATION: Python 3.5 reached the end of its life on September 13th, 2020. Please upgrade your Python as Python 3.5 is no longer maintained. pip 21.0 will drop support for Python 3.5 in January 2021. pip 21.0 will remove support for this functionality.
ERROR: Could not find a version that satisfies the requirement django==3.1.4
ERROR: No matching distribution found for django==3.1.4
2020-12-26T14:54:36.2470993Z Successfully updated deployment History at https://xxx-dev.scm.azurewebsites.net/api/deployments/321608994474759
2020-12-26T14:54:36.5240518Z App Service Application URL: http://xxx-dev.azurewebsites.net
2020-12-26T14:54:36.5358824Z ##[section]Finishing: Deploy Azure App Service
这是已知的 - 更重要的是有没有办法解决这个问题?
有趣的是,当我 ssh 进入 web 应用程序/应用程序服务并执行命令时一切正常
【问题讨论】:
-
PHP 也存在同样的问题 - 指定版本 7.4 仍将解决 InlineScript 中的版本 7.3。
标签: python-3.x django azure-devops azure-web-app-service