Search code examples
python-2.7azureflaskazure-deployment

Azure flask <handler> scriptProcessor could not be found in <fastCGI> application configuration


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.


Solution

  • 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.