当我将Django应用程序部署到Azure Web应用程序服务时,Requirements.txt会导致错误

时间:2017-08-22 16:56:12

标签: python django azure azure-web-sites requirements.txt

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

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

django<2
django-crispy-forms==1.6.1

现在,当我尝试将我的提交推送到服务器时(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

我试图查看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"

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

修改

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

1 个答案:

答案 0 :(得分:0)

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

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

Azure deployment steps