Skip to content Skip to sidebar Skip to footer

Azure Flask Routes Not Found

I am using visual studio to create a blank Flask app. When I run the application locally, I get the expected 'hello world'. When I publish to Azure App Service, I get this nice ugl

Solution 1:

Please refer to my work steps and see if the error still shows up.

Step 1 : Create azure web app and add Extensions(here is Python 3.6.1 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><addkey="WSGI_HANDLER"value="<Your Project Name>.app"/><addkey="PYTHONPATH"value="D:\home\site\wwwroot"/><addkey="WSGI_LOG"value="D:\home\LogFiles\wfastcgi.log"/></appSettings><system.webServer><handlers><addname="PythonHandler"path="*"verb="*"modules="FastCgiModule"scriptProcessor="D:\home\Python361x64\python.exe|D:\home\Python361x64\wfastcgi.py"resourceType="Unspecified"requireAccess="Script"/></handlers></system.webServer></configuration>

If you deploy successfully, you could see following structure in the KUDU path: D:\home\site\wwwroot>.

enter image description here

If you want to use additional python package, please go on.

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 pyodbc

enter image description here

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


Update:

In my steps, copy content in https://bootstrap.pypa.io/get-pip.py to install pip. It could identify the system python version, install the corresponding python package.

enter image description here

So,you just need to run the command python -m pip install newspaper3k to install newspaper3k.

enter image description here

Post a Comment for "Azure Flask Routes Not Found"