【问题标题】:Requirements.txt causes an error when I'm deploying my Django app to the Azure web app service当我将 Django 应用程序部署到 Azure Web 应用程序服务时,Requirements.txt 会导致错误
【发布时间】:2018-03-13 15:03:19
【问题描述】:

我在 Azure Web 应用服务上托管了一个 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,但它没有解释错误发生的原因。

【问题讨论】:

    标签: python django azure azure-web-app-service requirements.txt


    【解决方案1】:

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

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

    【讨论】:

      猜你喜欢
      • 2016-07-01
      • 2023-03-27
      • 1970-01-01
      • 1970-01-01
      • 2019-06-09
      • 1970-01-01
      • 1970-01-01
      • 2020-02-04
      • 1970-01-01
      相关资源
      最近更新 更多