我試圖讓我的服務器使用https/ssl連接。我有證書和鑰匙。 我試過使用http://webpy.org/cookbook/ssl中的例子,但它仍然使用http而不是https。我的web.py版本是最新的最新(0.38),但我試圖使用該網站藏漢呈現舊的實現,這就造成了錯誤:無法在web.py中創建ssl會話 - Python 2.7
Traceback (most recent call last):
File "/path/server.py", line 7, in <module>
from web.wsgiserver.ssl_builtin import BuiltinSSLAdapter
File "/Library/Python/2.7/site-packages/web/wsgiserver/ssl_builtin.py", line 14, in <module>
from cherrypy import wsgiserver
ImportError: cannot import name wsgiserver
在行:
from web.wsgiserver.ssl_builtin import BuiltinSSLAdapter
任何解決方案? (我想這不是因爲它的使用適合舊版本的web.py,而是第一次實現)所導致的錯誤。
感謝
編輯: 我運行代碼:
import sys
import web
from web.wsgiserver import CherryPyWSGIServer
from utils.tools import Tools
from pages.index import index
from pages.search import search
from pages.update_location import update_location
from pages.add_sn_tracking import add_sn_tracking
from pages.edit_sn_tracking import edit_sn_tracking
from pages.add_sheet_tracking import add_sheet_tracking
from pages.edit_sheet_tracking import edit_sheet_tracking
class WebServer:
def __init__(self):
CherryPyWSGIServer.ssl_certificate = r"/Volumes/wlutils/Users/TesterUs/snserver/server.crt"
CherryPyWSGIServer.ssl_private_key = r"/Volumes/wlutils/Users/TesterUs/snserver/server.key"
self.urls = (
'/', 'index',
'/search', 'search',
'/update_location', 'update_location',
'/add_sn_tracking', 'add_sn_tracking',
'/edit_sn_tracking', 'edit_sn_tracking',
'/add_sheet_tracking', 'add_sheet_tracking',
'/edit_sheet_tracking', 'edit_sheet_tracking',
)
# web.config.debug = False
self.app = web.application(self.urls, globals())
self.app.run()
if __name__ == "__main__":
w = WebServer()
只是檢查 - 你不是使用nginx或apache來面向web.py,對嗎? – pbuck
多數民衆贊成那是正確的,只有web.py – Jonathan