lad*_*ari 14 python django werkzeug
将 Werkzeug 版本从 2.0.3 更新到 2.1.0 后,每次运行服务器时都会出现错误,错误日志如下:
Exception happened during processing of request from ('127.0.0.1', 44612)
Traceback (most recent call last):
File "/usr/lib/python3.8/socketserver.py", line 683, in process_request_thread
self.finish_request(request, client_address)
File "/usr/lib/python3.8/socketserver.py", line 360, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/lib/python3.8/socketserver.py", line 747, in __init__
self.handle()
File "/home/oladhari/.virtualenvs/reachat/lib/python3.8/site-packages/werkzeug/serving.py", line 363, in handle
super().handle()
File "/usr/lib/python3.8/http/server.py", line 427, in handle
self.handle_one_request()
File "/usr/lib/python3.8/http/server.py", line 415, in handle_one_request
method()
File "/home/oladhari/.virtualenvs/reachat/lib/python3.8/site-packages/werkzeug/serving.py", line 243, in run_wsgi
self.environ = environ = self.make_environ()
File "/home/oladhari/.virtualenvs/reachat/lib/python3.8/site-packages/django_extensions/management/commands/runserver_plus.py", line 326, in make_environ
del environ['werkzeug.server.shutdown']
KeyError: 'werkzeug.server.shutdown'
Run Code Online (Sandbox Code Playgroud)
当递增 2 ( ('127.0.0.1', 44612) -> ('127.0.0.1', 44628) 时,此异常不断出现,并且服务器崩溃
检查更改日志,我发现了这个细节:
Remove previously deprecated code. #2276
Remove the non-standard shutdown function from the WSGI environ when running the development server. See the docs for alternatives.
Run Code Online (Sandbox Code Playgroud)
这是更改日志的链接
它要求检查替代方案的文档,但找不到任何替代方案
请让我知道如何解决这个错误,谢谢注意:我的Python版本是3.8
小智 24
今天刚遇到这个问题。根据他们的(git repo issues 1715)并假设你正在运行runserver_plus,有三个选项对某些用户有用。第一个对我有用:
--keep-meta-shutdown。我的完整命令看起来像python manage.py runserver_plus --cert-file /path/to/cert.pem --key-file /path/to/key.pem --keep-meta-shutdown localhost:9000希望这可以帮助!
| 归档时间: |
|
| 查看次数: |
4121 次 |
| 最近记录: |