Azure Python Web App内部服务器错误 [英] Azure Python Web App Internal Server Error

查看:91
本文介绍了Azure Python Web App内部服务器错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题似乎是在我的应用程序中导入软件包.所有软件包都已正确安装,我可以在带有Kudu的wwwroot中看到它们. 但是,当我将它们导入脚本时,出现500错误.最奇怪的是,仅当我以这种方式导入软件包时,问题才会出现:

The problem seems to be the importing of packages in my app. All the packages are correctly installed, and i can see them in my wwwroot with kudu. But, when i import them in the scripts, i get the 500 error. The WIERDEST thing is that the problem only occurs when i import the packages this way:

from package import something

但不是这样:

import package

当我尝试调用包函数时,我也遇到相同的错误,这意味着我无法访问包中的任何内容(?)

I also get the same error, when i try to call a package function, meaning i cant access anything from the packages(?)

似乎在Web应用程序中生成了一个异常,但在我的本地计算机中却没有.有什么想法吗?

It seems that there is an exception generated in web app, but not in my local machine. Any thoughts?

我正在尝试在Azure Web Apps中发布Python Web App,但是我一直失败. 我正在使用bottle作为Web框架,我安装的软件包以及它们的依赖项是:

I'm trying to publish a Python Web App in Azure Web Apps, but I keep failing. I'm using bottle as the web framework, and the packages i installed, along with their dependencies are:

  • 脾气暴躁
  • Scipy
  • Scikit图片

我已将虚拟环境配置为与Web应用程序(32位/2.7)匹配,并且按照本文中所述的方式使用滚轮安装了软件包: https://azure.microsoft.com/zh-cn/documentation/articles/web-sites- python-create-deploy-bottle-app/

I have configured the virtual env to match the web app (32bit/2.7), and i installed the packages using wheels as mentioned in this post: https://azure.microsoft.com/en-us/documentation/articles/web-sites-python-create-deploy-bottle-app/

我正在通过VS和Azure SDK中的发布向导部署应用程序,一切正常.

I'm deploying the app via VS and the publish wizard from Azure SDK, and everything works as expected.

当应用启动时,出现500错误,控制台显示以下内容:

When the app is up, i get a 500 error, and the console says these things:

我的web.cofing是这样的:

My web.cofing is this:

    <?xml version="1.0"?>
<!-- Generated web.config for Microsoft Azure. Remove this comment to prevent
     modifications being overwritten when publishing the project.
-->
<configuration>
  <system.diagnostics>
    <trace>
      <listeners>
        <add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31b....." name="AzureDiagnostics">
          <filter type="" />
        </add>
      </listeners>
    </trace>
  </system.diagnostics>
  <appSettings>
    <add key="WSGI_ALT_VIRTUALENV_HANDLER" value="app.wsgi_app()" />
    <add key="WSGI_ALT_VIRTUALENV_ACTIVATE_THIS" value="D:\home\site\wwwroot\env\Scripts\activate_this.py" />
    <add key="WSGI_HANDLER" value="ptvs_virtualenv_proxy.get_virtualenv_handler()" />
    <add key="PYTHONPATH" value="D:\home\site\wwwroot" />
  </appSettings>
  <system.web>
    <compilation debug="true" targetFramework="4.0" />
  </system.web>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="true" />
    <handlers>
      <add name="Python FastCGI" path="handler.fcgi" verb="*" modules="FastCgiModule" scriptProcessor="D:\Python27\python.exe|D:\Python27\Scripts\wfastcgi.py" resourceType="Unspecified" requireAccess="Script" />
    </handlers>
    <rewrite>
      <rules>
        <rule name="Static Files" stopProcessing="true">
          <conditions>
            <add input="true" pattern="false" />
          </conditions>
        </rule>
        <rule name="Configure Python" stopProcessing="true">
          <match url="(.*)" ignoreCase="false" />
          <conditions>
            <add input="{REQUEST_URI}" pattern="^/static/.*" ignoreCase="true" negate="true" />
          </conditions>
          <action type="Rewrite" url="handler.fcgi/{R:1}" appendQueryString="true" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>

为什么会发生这种情况?

Any help why this might happening?

推荐答案

最后,我知道了. 问题是我用来安装车轮的pip版本.我升级到pip 8.11.1后,一切都按预期进行.

FINALLY, i got it working. The problem was the version of pip i was using to install the wheels. After i upgraded to pip 8.11.1 everything worked as expected.

这篇关于Azure Python Web App内部服务器错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆