Having big problems trying to get our Python Fastapi code working on an Azure server

Viewed 133

We have an API built on FastAPIin Python. I am relatively new to Azure publishing, but I am not able to get the code working on either a Windows VM, or App Service Windows machine. We are stuck trying to figure out what the issue is. We have read MS web.config examples and tried putting our info in and still gives a 501 error trying to parse the file. I can't figure it out for the life of me.

I get this error (500.19) if I use this type of config:

enter image description here

<?xml version="1.0" encoding="utf-8"?>

<httpPlatform processPath="C:\Python310\python.exe"
              arguments="C:\inetpub\wwwroot\fastAPI\main.py --port %HTTP_PLATFORM_PORT%"
              stdoutLogEnabled="true"
              stdoutLogFile="C:\inetpub\LogFiles\python.log"
              startupTimeLimit="60"
              processesPerApplication="16">
  

and this if I use the example Fastapi from MS examples I still get an error... and how would I specify to run the main.py file.

enter image description here

<?xml version="1.0" encoding="utf-8"?>

<!-- The handler here is specific to Bottle; other frameworks vary. -->


  <add name="PythonHandler" path="*" verb="*" modules="FastCgiModule"
       scriptProcessor="C:\Python310\python.exe|C:\Python310\Lib\site-packages\wfastcgi.py"
       resourceType="Unspecified" requireAccess="Script"/>

The reason I am using Windows is I have a C# DLL that I have to access for encryption/decryption.

I have installed the Python extensions on the App Service. I have also installed whatever I thought was needed on the Windows VM too.

0 Answers
Related