Azure Python Web 应用程序内部服务器错误

问题描述

EDIT: 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

But not this way:

import package

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

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


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:

  • Numpy
  • Scipy
  • Scikit-image

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/

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

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

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:homesitewwwrootenvScriptsactivate_this.py" />
    <add key="WSGI_HANDLER" value="ptvs_virtualenv_proxy.get_virtualenv_handler()" />
    <add key="PYTHONPATH" value="D:homesitewwwroot" />
  </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:Python27python.exe|D:Python27Scriptswfastcgi.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?

解决方案

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.

相关文章