现在我在pylons的项目配置中有以下几行:
[server:main]
...
ssl_pem = /path-to-pem/file-name.pem
所以paster只提供HTTPS请求,但不提供HTTP。任何HTTP请求都会在paster调试控制台中导致以下异常:
Traceback (most recent call last):
File "/home/eigenein/Projects/Python/Pylons/lib/python2.6/site-packages/Paste-1.7.4-py2.6.egg/paste/httpserver.py", line 1068, in process_request_in_thread
self.finish_request(request, client_address)
File "/usr/lib/python2.6/SocketServer.py", line 320, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/lib/python2.6/SocketServer.py", line 615, in __init__
self.handle()
File "/home/eigenein/Projects/Python/Pylons/lib/python2.6/site-packages/Paste-1.7.4-py2.6.egg/paste/httpserver.py", line 442, in handle
BaseHTTPRequestHandler.handle(self)
File "/usr/lib/python2.6/BaseHTTPServer.py", line 329, in handle
self.handle_one_request()
File "/home/eigenein/Projects/Python/Pylons/lib/python2.6/site-packages/Paste-1.7.4-py2.6.egg/paste/httpserver.py", line 431, in handle_one_request
self.raw_requestline = self.rfile.readline()
File "/usr/lib/python2.6/socket.py", line 406, in readline
data = self._sock.recv(self._rbufsize)
Error: [('SSL routines', 'SSL23_GET_CLIENT_HELLO', 'http request')]
是否可以设置贴纸来提供HTTP请求?
答案 0 :(得分:1)
根据Pylons常见问题解答,没有。
http://wiki.pylonshq.com/pages/viewpage.action?pageId=13434886
这是一个非常古老的条目,但我找不到任何可以在将来的版本中配置它的更改。
答案 1 :(得分:0)
通常,你应该使用一些前端服务器,比如nginx。让它处理SSL /非SSL,然后通过http / wsgi / fcgi将请求传递给paster。