A
A
Aleksey Anisenkov2016-08-15 22:36:44
IIS
Aleksey Anisenkov, 2016-08-15 22:36:44

How to run Flask on IIS 7.5 via wfastcgi.py?

We have Windows Server 2008 R2, IIS 7.5, Python 3.5.2, Flask 0.11, wfastcgi.py 2.2, we need to earn it all together.
I do everything according to the instructions:
1) the FastCGI module is installed on IIS
2) the main script c:\MyApp\myapp.py

from flask import Flask
app = Flask(__name__)

@app.route("/")
def index():
    return "Hello World!"

if __name__ == "__main__":
    app.run()

3) configuration file for IIS
<configuration>
  <system.webServer>
    <handlers>
      <add name="Python FastCGI"
           path="*"
           verb="*"
           modules="FastCgiModule"
           scriptProcessor="C:\Python35\python.exe|C:\Python35\Lib\site-packages\wfastcgi.py"
           resourceType="Unspecified"
           requireAccess="Script" />
    </handlers>
  </system.webServer>

  <appSettings>
    <!-- Required settings -->
    <add key="WSGI_HANDLER" value="myapp.app" />
    <add key="PYTHONPATH" value="C:\MyApp" />

    <!-- Optional settings -->
    <add key="WSGI_LOG" value="C:\Logs\myapp.log" />
    <add key="WSGI_RESTART_FILE_REGEX" value=".*((\.py)|(\.config))$" />
  </appSettings>
</configuration>

4) wfastcgi is activated via wfastcgi-enable
5) An IIS application with the name myapp is configured on the C:\MyApp directory

After all this, the localhost / myapp site is not visible, 404 error

I see some obvious thing

PS the configuration is exactly like this, do not ask why, it is necessary to take off in this form.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
mortefy, 2018-06-21
@mortefy

try python version 3.4.2 x86

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question