isapi-wsgi+web2py almost working

28 views
Skip to first unread message

Kirby Turner

unread,
Feb 25, 2009, 9:08:11 AM2/25/09
to web...@googlegroups.com
Hi All,

I'm very close to having web2py running under IIS using isapi-wsgi. I
have included below the isapi-wsgihandler.py file I created (see
below). It's based on web2py's own wsgihandler.py and has been
modified to include code needed for isapi-wsgi. I'll post to the FAQ
once I have everything working.

That said, I have encountered 1 problem not related to web2py. I've
searched everywhere for a solution but can't find one which is why I'm
posting this message. The problem I have is that python cannot load
the module _socket. The module is available in C:\Python26\DLLs\ and
that directory is included in the system path.

Any python-win32 pros out there know why the module cannot be imported
and what I must to fix the problem?

Thanks,
-KIRBY


#!/usr/bin/python
"""
This is a ISAPI-WSGI handler for IIS

"""

import sys, os

if hasattr(sys, "isapidllhandle"):
import win32traceutil

sys.path.insert(0,'')
path=os.path.dirname(os.path.abspath(__file__))
if not path in sys.path: sys.path.append(path)
os.chdir(path)

import gluon.main
from gluon.contrib.wsgihooks import ExecuteOnCompletion2, callback

application=ExecuteOnCompletion2(gluon.main.wsgibase, callback)

## or
# application=gluon.main.wsgibase_with_logging

import isapi_wsgi
# The entry points for the ISAPI extension.
def __ExtensionFactory__():
return isapi_wsgi.ISAPIThreadPoolHandler(application)

if __name__=='__main__':
# If run from the command-line, install ourselves.
from isapi.install import *
params = ISAPIParameters()
# Setup the virtual directories - this is a list of directories our
# extension uses - in this case only 1.
# Each extension has a "script map" - this is the mapping of ISAPI
# extensions.
sm = [
ScriptMapParams(Extension="*", Flags=0)
]
vd = VirtualDirParameters(Name="web2py",
Description = "ISAPI-WSGI
ISAPISimpleHandler web2py site",
ScriptMaps = sm,
ScriptMapUpdate = "replace"
)
params.VirtualDirs = [vd]
HandleCommandLine(params)


Kirby Turner

unread,
Feb 25, 2009, 9:12:38 AM2/25/09
to web...@googlegroups.com
By the way, I should add that I have no problems running web2py.py
from the command line. My applications run fine. The import only
fails when I try to run with isapi-wsgi.

Thanks,
-KIRBY

Kirby Turner

unread,
Feb 25, 2009, 11:22:58 AM2/25/09
to web...@googlegroups.com
Think I found the problem. There is a known issue with Python 2.6.1
on Windows that is preventing the ISAPI Extension from loading .pyd.
The problem has been resolved and confirmed in Python 2.6.2 and 3.0.1

http://sourceforge.net/tracker/index.php?func=detail&aid=2609380&group_id=78018&atid=551954

-KIRBY

mdipierro

unread,
Feb 25, 2009, 11:25:03 AM2/25/09
to web2py Web Framework
My guess is that this is path related
Reply all
Reply to author
Forward
0 new messages