代码确实运行了:
Lubuntu 16.10、Python 3.5.2 (python3)、psql 9.5.7 和 pgAdmin 1.22.1。... 还安装了:Python 2.7.12 (python)
代码无法运行:
Ubuntu 18.04、Python 3.6.5(python 和 python3)、psql 10.4 和 pgAdmin 1.22.2。
扩展:在virtualenv中安装相同版本的扩展。
错误消息:现在出现以下错误消息:
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/usr/lib/python3.6/threading.py", line 864, in run
self._target(*self._args, **self._kwargs)
File "/home/myname/Documents/projectname/venv/lib/python3.6/site-packages/werkzeug/serving.py", line 699, in inner
fd=fd)
File "/home/myname/Documents/projectname/venv/lib/python3.6/site-packages/werkzeug/serving.py", line 593, in make_server
passthrough_errors, ssl_context, fd=fd)
File "/home/myname/Documents/projectname/venv/lib/python3.6/site-packages/werkzeug/serving.py", line 528, in __init__
self.socket = ssl_context.wrap_socket(sock, server_side=True)
File "/home/myname/Documents/projectname/venv/lib/python3.6/site-packages/werkzeug/serving.py", line 450, in wrap_socket
ssl_version=self._protocol, **kwargs)
File "/usr/lib/python3.6/ssl.py", line 1149, in wrap_socket
ciphers=ciphers)
File "/usr/lib/python3.6/ssl.py", line 747, in __init__
self._context.load_cert_chain(certfile, keyfile)
FileNotFoundError: [Errno 2] No such file or directory
答案1
在某些时候,您会给它提供 ssl 密钥文件 (.pem|.crt|.key),但该文件未找到,请检查您的配置并检查 ssl 密钥的路径。也许在您的配置中的某个地方您需要输入是否要使用 ssl,而它却被意外设置为“true”。
您可以使用有效的证书,或者取消 SSL。