I was following this guide:
http://www.web2pyslices.com/slice/show/1453/install-web2py-on-windows-with-iis
I am attempting #2 : Web2py is called from ISAPI handler in the dedicated
AppPool natively in Microsoft IIS
isapi-wsgi is installed and
>python isapi_wsgi.py install
works properly (I have created a 32-bit pool for it)
I created this isapi_web2py.py
import win32traceutil
### The entry point for the ISAPI extension.
def __ExtensionFactory__():
import os
import sys
path = os.path.dirname(os.path.abspath(__file__))
os.chdir(path)
sys.path = [path]+[p for p in sys.path if not p==path]
import gluon.main
import isapi_wsgi
application=gluon.main.wsgibase
return isapi_wsgi.ISAPIThreadPoolHandler(application)
### ISAPI installation:
### python isapi_web2py.py install --server=Sitename
if __name__=='__main__':
from isapi.install import ISAPIParameters, ScriptMapParams,
VirtualDirParameters, HandleCommandLine
params = ISAPIParameters()
sm = [
ScriptMapParams(Extension="*", Flags=0)
]
vd = VirtualDirParameters(Name="appname",
Description = "Web2py in Python",
ScriptMaps = sm,
ScriptMapUpdate = "replace"
)
params.VirtualDirs = [vd]
HandleCommandLine(params)
from the command line I run:
python isapi_web2py.py
I check IIS, I see a virtual directory created, I make sure that the web2py
application code is in that virtual directory.
I navigate to virtual directory in IIS (error 500 returned)
I run python -m win32traceutil
I get:
NameError: name 'ISAPIParameters' is not defined
that is error on this line of isapi_web2py.py: params = ISAPIParameters()
I guess this means I'm not in main? Have I installed this correctly? I
tried moving the import statement out, then I just error out on
intsall.py's HandleCommandLine method around here argv = argv or sys.argv