Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 13951

Configuring python for IIS [duplicate]

$
0
0

Following the steps in https://learn.microsoft.com/en-us/visualstudio/python/configure-web-apps-for-iis-windows?view=vs-2019 to configure flask app to run behind IIS and searching online I couldn't find a solution that fix my problem.

I have my web.config as:

<?xml version="1.0" encoding="utf-8"?><configuration><system.webServer><handlers><add name="PythonHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified"/></handlers><httpPlatform processPath="C:\envs\Scripts\python.exe"                      arguments="-m flask run --port %HTTP_PLATFORM_PORT%"                      stdoutLogEnabled="true"                      stdoutLogFile="C:\logs\python.log"                      startupTimeLimit="60"                      processesPerApplication="16"><environmentVariables><environmentVariable name="FLASK_APP" value="app.py" /></environmentVariables></httpPlatform></system.webServer></configuration>

A visit to the site just spit the following. I tried all possible solutions I came across which include giving IIS_IUSRS access. Running the app on command prompt runs just fine. The IIS error message is not helping.

enter image description here

edit:

after installing the http platformhandler and now on a different dev box, I can see the handler at work but just a different monster:

502.3 Bad GatewayDetailed Error Information:**Module**        httpPlatformHandler              **Requested URL**  http://127.0.0.1:5007/about**Notification**  ExecuteRequestHandler         **Physical Path**  C:\inetpub\wwwroot\app\about**Handler**       PythonHandler                 **Logon Method**   Anonymous**Error Code**    0x8007042b                    **Logon User**     Anonymous

Which tells me the handler is just handling the url as just folders in my app root because http://127.0.0.1:5007/about is nothing but a route to:

myapp_about.py:

from flask import Blueprint, jsonifymyapp_about = Blueprint('about', __name__)@myapp_about.route('/about')def get_about():    return jsonify({"wow": "We really are routed to here. maybe not"})

Viewing all articles
Browse latest Browse all 13951

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>