Requirements.txt causes an error when I'm deploying my Django app to the Azure web app service

时间:2021-12-15 21:30:04

I've got a Django app hosted on the Azure web app service. I recently removed the skipPythonDeployment file, so that I can add custom packages from my requirements.txt file. At first this worked fine when I added just the crispy forms package. But after that, I wanted to update my Django installation to 1.11 (the default version in the app service is 1.9.4).

我在Azure网络应用服务上托管了一个Django应用。我最近删除了skipPythonDeployment文件,以便我可以从requirements.txt文件中添加自定义包。首先,当我添加了酥脆的包装时,这个工作正常。但在那之后,我想将我的Django安装更新为1.11(应用服务中的默认版本是1.9.4)。

So this is what my requirements.txt looks currently:

所以这就是我的requirements.txt目前的样子:

django<2
django-crispy-forms==1.6.1

Now, when I try to push my commits to the server (git push azure master) I get the following deployment log:

现在,当我尝试将我的提交推送到服务器(git push azure master)时,我得到以下部署日志:

Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 308 bytes | 0 bytes/s, done.
Total 3 (delta 1), reused 1 (delta 0)
remote: Updating branch 'master'.
remote: .............................................
remote: Updating submodules.
remote: Preparing deployment for commit id '763167dc3c'.
remote: Generating deployment script.
remote: Running deployment command...
remote: Handling python deployment.
remote: Detected requirements.txt.  You can skip Python specific steps 
with a .skipPythonDeployment file.
remote: Detecting Python runtime from site configuration
remote: Detected python-2.7
remote: Found compatible virtual environment.
remote: Pip install requirements.
remote: An error has occurred during web site deployment.
remote: 
remote: Error - Changes committed to remote repository but deployment to website failed.
To https://username@project.scm.azurewebsites.net:443/b

I've tried to look at Azures commit logs but the error is pretty much the same:

我试图查看Azures提交日志,但错误几乎相同:

Command: "D:\home\site\deployments\tools\deploy.cmd"
Handling python deployment.
Detected requirements.txt.  You can skip Python specific steps with a 
.skipPythonDeployment file.
Detecting Python runtime from site configuration
Detected python-2.7
Found compatible virtual environment.
Pip install requirements.
An error has occurred during web site deployment.
\r\nD:\Program Files 
(x86)\SiteExtensions\Kudu\65.60816.2969\bin\Scripts\starter.cmd 
"D:\home\site\deployments\tools\deploy.cmd"

Any idea what I'm doing wrong here? Or where I could see the actual error?

知道我在这里做错了吗?或者我在哪里可以看到实际的错误?

EDIT

This github thread (https://github.com/azureappserviceoss/DjangoAzure/issues/2) provided a workaround, by deleting env/azure.env.python-2.7.txt from the server, but it doesn't explain why the error happens.

这个github线程(https://github.com/azureappserviceoss/DjangoAzure/issues/2)提供了一个解决方法,通过从服务器删除env / azure.env.python-2.7.txt,但它没有解释为什么错误发生。

1 个解决方案

#1


0  

Most likely this is some pip error. In Azure, you can see the pip log output on the "Deployment options" blade. (You may need to configure the web app to track your git branch and automatically sync with it if you haven't already.) If your most recent deployment failed, you would see a red exclamation point; click on that deployment and then click "View log" next to your deployment command. This will let you see the pip output and what went wrong.

很可能这是一些点差错误。在Azure中,您可以在“部署选项”刀片上看到pip日志输出。 (您可能需要配置Web应用程序以跟踪您的git分支并自动与它同步。)如果您最近的部署失败,您会看到一个红色感叹号;单击该部署,然后单击部署命令旁边的“查看日志”。这将让你看到pip输出和出了什么问题。

You can also access the pip logs on your app server if you access the FTP site.

如果访问FTP站点,还可以访问应用服务器上的pip日志。

Requirements.txt causes an error when I'm deploying my Django app to the Azure web app service

#1


0  

Most likely this is some pip error. In Azure, you can see the pip log output on the "Deployment options" blade. (You may need to configure the web app to track your git branch and automatically sync with it if you haven't already.) If your most recent deployment failed, you would see a red exclamation point; click on that deployment and then click "View log" next to your deployment command. This will let you see the pip output and what went wrong.

很可能这是一些点差错误。在Azure中,您可以在“部署选项”刀片上看到pip日志输出。 (您可能需要配置Web应用程序以跟踪您的git分支并自动与它同步。)如果您最近的部署失败,您会看到一个红色感叹号;单击该部署,然后单击部署命令旁边的“查看日志”。这将让你看到pip输出和出了什么问题。

You can also access the pip logs on your app server if you access the FTP site.

如果访问FTP站点,还可以访问应用服务器上的pip日志。

Requirements.txt causes an error when I'm deploying my Django app to the Azure web app service