Created
November 8, 2011 11:26
-
-
Save kamyar1979/1347537 to your computer and use it in GitHub Desktop.
Script for making wsgi isapi for web2py project.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys, os | |
if hasattr(sys, "isapidllhandle"): | |
import win32traceutil | |
sys.path.insert(0,'') | |
path=os.path.dirname(os.path.abspath('D:\\web2py\\gluon')) | |
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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment