4

I am trying to deploy Python Flask application in the Azure web app. I had create web app(Flask) and published my code. After publish, I am getting below error from the site.

The page cannot be displayed because an internal server error has occurred.

When check the Log, i could see the below error.

enter image description here

But this was happening only in my subscription(free subscription got with MSDN). But working fine in the Organisation subscription.

  • well, this error has nothing to do with subscription for sure, something in the webapp settings differ – 4c74356b41 Feb 24 '17 at 12:26
  • I am not changing anything, other then my subscription in the publish profile. – kabilan Mohanasundaram Feb 24 '17 at 12:30
  • well, probably something with the way you've created the webapp, subscription cannot interfere with the webapp, at least I can imagine a way – 4c74356b41 Feb 24 '17 at 13:55
  • I am debugging similar issue. The current way to fix it (for me) is to set environment variables in Applicaton Settings along with Handler mapping. I can’t understand why wfastcgi.py ignores web.config – voldmar Apr 03 '17 at 22:48

1 Answers1

3

The <fastCGI> settings must be in the applicationHost.config file (in the system.webServer section) of IIS. Just putting it into web.config does not work (confirmed by testing it on a local IIS, not in Azure). An example configuration may look like this:

<fastCgi>
  <application
    fullPath="D:\home\Python27\python.exe"
    arguments="D:\home\Python27\wfastcgi.py"
    maxInstances="16"
    idleTimeout="21600"
    instanceMaxRequests="10000000"
    signalBeforeTerminateSeconds="60"
    xdt:Transform="InsertIfMissing"
    xdt:Locator="Match(fullPath)">
    <environmentVariables>
      <environmentVariable name="PYTHONHOME" value="D:\home\Python27" />
    </environmentVariables>
  </application>
</fastCgi>

You may want to adjust this configuration.

This should solve it for a local IIS where you can edit applicationHost.config. I'm not sure about Azure, but maybe you can find some hints here: https://github.com/Azure/azure-python-siteextensions/issues/2.

Florian Winter
  • 4,750
  • 1
  • 44
  • 69
  • 1
    Por aca dejo un tutorial sobre como realizar esta configuración: https://github.com/bitcubico/python-tutorial/blob/master/IIS-CONFIG.md – bitcubico Jul 31 '20 at 16:41