Issue
I have a WebServer running which has two different application under Default WebSite as portal and server. I would like to create an another application hosted by flask and python to be served. I was able to do it by creating a new website named as flask but i would like to create as an application.
I could not find any guide to serve it under Default Web Site as an application is there a way? Below you can see i hosted as an web site as flask, it works but i need to host it under my domain to access it from internet, however i could not make correct configurations to serve it under Default Web Site as an application.
Solution
I'm not sure which method you used to deploy your Flask app, I think you should pay attention to its routing issue:@app.route("/FlaskApp/")
. I did some simple tests like this(with FastCGI):
from flask import Flask
app = Flask(__name__)
@app.route("/FlaskApp/")
def hello():
return "Hello from FastCGI via IIS!"
if __name__ == "__main__":
app.run()
web.config
<configuration>
<system.webServer>
<handlers>
<add name="flaskhandler" path="*" verb="*" modules="FastCgiModule" scriptProcessor="C:\Python\python.exe|C:\Python\Lib\site-packages\wfastcgi.py" resourceType="Unspecified" requireAccess="Script" />
</handlers>
</system.webServer>
<appSettings>
<add key="PYTHONPATH" value="C:\inetpub\wwwroot\FlaskApp" />
<add key="WSGI_HANDLER" value="app.app" />
</appSettings>
</configuration>
Answered By - Xudong Peng
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.