IIS error when running flask

Repository of web frameworks and applications for Microsoft IIS.
User avatar
Posts: 3
Joined: 27 Dec 2013, 09:36

IIS error when running flask

27 Dec 2013, 10:01

Hi

I'm a Flask app with Helicon Zoo on IIS 8.0 and I'm getting the following error from Helicon
Code: Select all
Worker Status
Online
Windows error
The pipe has been ended. (ERROR CODE: 109)
Internal module error
message: Connection has broken type: ZooException file: ZooApplication.cpp line: 890 version: 3.1.98.496
STDERR
Traceback (most recent call last): File "C:\Zoo\Workers\python\zoofcgi.py", line 1072, in <module> run_wsgi_app(options.wsgi_app) File "C:\Zoo\Workers\python\zoofcgi.py", line 1013, in run_wsgi_app FCGIServer(wsgi_app).run() File "C:\Zoo\Workers\python\zoofcgi.py", line 776, in run conn.run() File "C:\Zoo\Workers\python\zoofcgi.py", line 569, in run self.process_input() File "C:\Zoo\Workers\python\zoofcgi.py", line 600, in process_input self._do_stdin(rec) File "C:\Zoo\Workers\python\zoofcgi.py", line 724, in _do_stdin self._start_request(req) File "C:\Zoo\Workers\python\zoofcgi.py", line 697, in _start_request req.run() File "C:\Zoo\Workers\python\zoofcgi.py", line 515, in run protocolStatus, appStatus = self.server.handler(self) File "C:\Zoo\Workers\python\zoofcgi.py", line 864, in handler for data in result: TypeError: 'NoneType' object is not iterable


Any idea what this means?

User avatar
Posts: 110
Joined: 07 Mar 2012, 10:22

Re: IIS error when running flask

30 Dec 2013, 07:03

Hello!

1. Could you please show the file with wsgi application (usually named wsgi.py) and web.config file.

2. Is the Flask app working without Helicon Zoo, in development server?

Thank you!

User avatar
Posts: 3
Joined: 27 Dec 2013, 09:36

Re: IIS error when running flask

30 Dec 2013, 08:29

Hi Ruslan and thank you for the reply,

1: this is my wsgi.py:
Code: Select all
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# flake8: noqa
import os
import sys
import site
sys.path.insert(0, 'C:\\inetpub\\wwwroot\\Project')

activate_this = "C:\\inetpub\\wwwroot\\Project\\venv\\Scripts\\activate_this.py"
execfile(activate_this, dict(__file__=activate_this)) #activate virtaul env

def application(environ, start_response):
    """WSGI Application"""
    from app import app as application   


And my web.config:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<heliconZoo>
<clear />
<application name="python.project">
<environmentVariables>
<add name="VIRTUAL_ENV" value="%APPL_PHYSICAL_PATH%\venv" />
<add name="PATH" value="%APPL_PHYSICAL_PATH%\venv\Scripts;%PATH%" />
<add name="PYTHONPATH" value="%APPL_PHYSICAL_PATH%\venv\Lib\site-packages\;%APPL_PHYSICAL_PATH%\venv\Lib;%APPL_PHYSICAL_PATH%;%APPL_PHYSICAL_PATH%;C:\inetpub\wwwroot\NovaGSX\venv\Lib\site-packages" />
<add name="WSGI_APP" value="wsgi.application" />
<add name="CONSOLE_URL" value="console" />
<add name="DEPLOY_FILE" value="deploy.py" />
<add name="ERROR_LOG_DIR" value="log" />
<add name="ZOOFCGI_DEBUG" value="True" />
</environmentVariables>
</application>
</heliconZoo>

<handlers>
<remove name="NovaGSX#x86" />
<remove name="NovaGSX#x64" />

<remove name="python.project#x86" />
<remove name="python.project#x64" />
<add name="python.project#x64" path="*" verb="*" modules="HeliconZoo_x64" scriptProcessor="python.2.7.wsgi" resourceType="Unspecified" requireAccess="Script" preCondition="bitness64" />
<add name="python.project#x86" path="*" verb="*" modules="HeliconZoo_x86" scriptProcessor="python.2.7.wsgi" resourceType="Unspecified" requireAccess="Script" preCondition="bitness32" />

<!-- Django or WSGI application over fastcgi -->


<!-- HTTP backend (Tornado) over http -->
<!--
<add name="python.project#x86" scriptProcessor="python.2.7.http" path="*" verb="*" modules="HeliconZoo_x86" preCondition="bitness32" resourceType="Unspecified" requireAccess="Script" />
<add name="python.project#x64" scriptProcessor="python.2.7.http" path="*" verb="*" modules="HeliconZoo_x64" preCondition="bitness64" resourceType="Unspecified" requireAccess="Script" />
-->

</handlers>

</system.webServer>
</configuration>



2: Yes, my flask app is working with the flask development server , i.e. app.run()

Thank you and best regards
-Ragnar

User avatar
Posts: 110
Joined: 07 Mar 2012, 10:22

Re: IIS error when running flask

30 Dec 2013, 11:49

Hello!

Looks like the issue in application function.
If you already have wsgi application object then you should not redefine it.

Instead of:

Code: Select all
def application(environ, start_response):
    """WSGI Application"""
    from app import app as application


you should use:

Code: Select all
from app import app
application = app


Thank you!

User avatar
Posts: 3
Joined: 27 Dec 2013, 09:36

Re: IIS error when running flask

02 Jan 2014, 06:35

Hi Ruslan,

You ware right, just use the flask object as the wsgi application object and I rocking :)

Thank you very much!
- Ragnar

Return to Helicon Zoo

Who is online

Users browsing this forum: No registered users and 10 guests