0

I am having some trouble getting my Py project to be deployed on Azure. The message I get is "The page cannot be displayed because an internal server error has occurred."

Which I know is a config error in the project. My web.config file has the below.

Python is installed in D in my azure web service and in C in my local machine running Py2.7

Appname is whiteboard

port 5965 on local host...

What am I doing wrong?? MS documentation did not help

<configuration>
    <appSettings>
    <add key="WSGI_HANDLER" value="whiteboard.app"/>
    <add key="PYTHONPATH" value="D:\home\site\wwwroot"/>
        <add key="WSGI_LOG" value="D:\home\LogFiles\wfastcgi.log"/>
    </appSettings>
    <system.webServer>
    <handlers>
    <add name="PythonHandler" path="*" verb="*" modules="FastCgiModule" scriptProcessor=" D:\home\Python27\python.exe|D:\home\Python27\wfastcgi.py"
        resourceType="Unspecified" requireAccess="Script"/>
    </handlers>
    <httpPlatform processPath="C:\Python27\python.exe"
    arguments="F:\FYP-Whiteboard\Whiteboard\whiteboard\runserver.py %HTTP_PLATFORM_PORT%5"
    stdoutLogEnabled="true"
    stdoutLogFile="F:\FYP-Whiteboard\Whiteboard\whiteboard\LogFiles\python.log"
    startupTimeLimit="60"
    processesPerApplication="16">
    <environmentVariables>
        <environmentVariable name="SERVER_PORT" value="5965" />
        <environmentVariable name="PYTHONPATH" value="D:\home\site\wwwroot" />
        <environmentVariable name="PORT" value="%HTTP_PLATFORM_PORT%" />
    </environmentVariables>
    </httpPlatform>
    </system.webServer>
    </configuration>

1 Answer 1

0

Per my experience, your issue is resulted from the package missing or route error in web.config.(Or you could find log in wfastcgi.log) I did test successfully, please refer to my working steps:

As you found in the Managing Python on Azure App Service , Azure App Service provide you with a site extension. You could install packages on KUDU console.

Step 1 : Create azure web app and add Extensions(here is Python 3.6.4 x64)

enter image description here

Step 2 : Publish your flask project and add the web.config.

web.config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <appSettings>
    <add key="WSGI_HANDLER" value="<Your Project Name>.app"/>
    <add key="PYTHONPATH" value="D:\home\site\wwwroot"/>
    <add key="WSGI_LOG" value="D:\home\LogFiles\wfastcgi.log"/>
  </appSettings>
  <system.webServer>
    <handlers>
      <add name="PythonHandler" path="*" verb="*" modules="FastCgiModule" scriptProcessor="D:\home\Python364x64\python.exe|D:\home\Python364x64\wfastcgi.py" resourceType="Unspecified" requireAccess="Script"/>
    </handlers>
  </system.webServer>
</configuration>

Step 3: Switch to the Kudu CMD and commands cd Python361x64 and touch get-pip.py and copy the content of the url https://bootstrap.pypa.io/get-pip.py into the get-pip.py via Edit button, then run python get-pip.py to install the pip tool.

enter image description here

Step 4 : Install any packages you need via python -m pip install Flask

enter image description here

Hope it helps you. Any concern ,please let me know.

Sign up to request clarification or add additional context in comments.

1 Comment

Yes I have done that already.The directory structure on the azure account has the python27 folder and the extension.. could you let me know what does the components httpplatform should contain? in arguments and process path? The location of the exe in the web directory(D there) or the loca(C drive in my machine)?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.