我在WAMP 服务器 2.5 , 32bits (Apache 2.4.9 32bits) 上使用 PythonWin 2.7.8 (默认, Jul 2 2014, 19:50:44) [MSC v.1500 32 bit (Intel)] 在 win32 上进行的 WSGI 设置继续下一条路。
WAMP route = C:/wamp/
配置阿帕奇
从http://www.apachelounge.com/viewtopic.php?t=5143下载 32bits mod_wsgi.so并将其放置为 c:\wamp\bin\apache\apache2.4.9\modules\mod_wsgi.so
将wsgi模块加载到apache主C:\wamp\bin\apache\apache2.4.9\conf\httpd.conf中:
LoadModule wsgi_module modules/mod_wsgi.so
WSGIScriptAlias /API c:/wamp/www/API/code.py
获取网页
C:\tmp>git clone git://github.com/webpy/webpy.git
C:\tmp>python webpy\setup.py install
测试它:
C:\tmp>python
ActivePython 2.7.8.10 (ActiveState Software Inc.) based on
Python 2.7.8(default, Jul 2 2014, 19:50:44) [MSC v.1500 32 bit (Intel)]
on win32 Type "help", "copyright", "credits" or "license" for more information.
>>> import web
>>>
将您的应用程序创建为 c:\wamp\www\API\code.py
import web
urls = (
'', 'root',
'/(.*)', 'hello',
)
class root:
def GET(self):
return "This is the root URI."
class hello:
def GET(self, name):
return "Hello %s from webPy." % name
application = web.application(urls, globals()).wsgifunc()
结果
重新启动您的 apache 网络服务器并检查http://localhost/API