0
當我試圖運行WSGI Python腳本從這個tutorial測試的FastCGI:WSGI Python的適配器測試的FastCGI:錯誤啓動WSGI服務器
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
from cgi import escape
import sys, os
from flup.server.fcgi import WSGIServer
def app(environ, start_response):
start_response('200 OK', [('Content-Type', 'text/html')])
yield '<h1>FastCGI Environment</h1>'
yield '<table>'
for k, v in sorted(environ.items()):
yield '<tr><th>%s</th><td>%s</td></tr>' % (escape(k), escape(v))
yield '</table>'
WSGIServer(app).run()
它導致以下,從錯誤日誌它不是根據返回的應用程序狀態0,不清楚發生了什麼問題。可能是因爲我錯過了一些東西。
Mod_python error: "PythonHandler mod_python.publisher"
Traceback (most recent call last):
File "/usr/local/lib64/python2.7/site-packages/mod_python/apache.py", line 398, in HandlerDispatch
result = obj(req)
File "/usr/local/lib64/python2.7/site-packages/mod_python/publisher.py", line 213, in handler
module = page_cache[req]
File "/usr/local/lib64/python2.7/site-packages/mod_python/cache.py", line 89, in __getitem__
return self._checkitem(name)[2]
File "/usr/local/lib64/python2.7/site-packages/mod_python/cache.py", line 131, in _checkitem
value = self.build(key, name, opened, entry)
File "/usr/local/lib64/python2.7/site-packages/mod_python/publisher.py", line 86, in build
return ModuleCache.build(self, key, req, opened, entry)
File "/usr/local/lib64/python2.7/site-packages/mod_python/cache.py", line 380, in build
exec(opened_as_str, module.__dict__)
File "<string>", line 21, in <module>
File "/usr/local/lib/python2.7/site-packages/flup/server/fcgi.py", line 112, in run
sock = self._setupSocket()
File "/usr/local/lib/python2.7/site-packages/flup/server/fcgi_base.py", line 997, in _setupSocket
req.run()
File "/usr/local/lib/python2.7/site-packages/flup/server/fcgi_base.py", line 572, in run
self._end(appStatus, protocolStatus)
File "/usr/local/lib/python2.7/site-packages/flup/server/fcgi_base.py", line 601, in _end
sys.exit(appStatus)
SystemExit: 0
暗示可能是它只在我通過Apache運行時纔會發生。在命令行中,它工作正常。