Update dependency werkzeug for python 3.8 compatibility
Launching the app with werkzeug version 0.15.4 (current state) renders the following error
sudo /usr/bin/gunicorn3 app:app -k geventwebsocket.gunicorn.workers.GeventWebSocketWorker -w 1 --bind 0.0.0.0:5000 --reload --access-logfile /var/log/gunicorn/access.log
[2020-01-04 22:17:34 +0800] [54955] [INFO] Starting gunicorn 20.0.4
[2020-01-04 22:17:34 +0800] [54955] [INFO] Listening at: http://0.0.0.0:5000 (54955)
[2020-01-04 22:17:34 +0800] [54955] [INFO] Using worker: geventwebsocket.gunicorn.workers.GeventWebSocketWorker
[2020-01-04 22:17:34 +0800] [54957] [INFO] Booting worker with pid: 54957
[2020-01-04 22:17:34 +0800] [54957] [ERROR] Exception in worker process
Traceback (most recent call last):
File "/usr/lib/python3.8/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
worker.init_process()
File "/usr/lib/python3.8/site-packages/gunicorn/workers/ggevent.py", line 162, in init_process
super().init_process()
File "/usr/lib/python3.8/site-packages/gunicorn/workers/base.py", line 119, in init_process
self.load_wsgi()
File "/usr/lib/python3.8/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi
self.wsgi = self.app.wsgi()
File "/usr/lib/python3.8/site-packages/gunicorn/app/base.py", line 67, in wsgi
self.callable = self.load()
File "/usr/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
return self.load_wsgiapp()
File "/usr/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
return util.import_app(self.app_uri)
File "/usr/lib/python3.8/site-packages/gunicorn/util.py", line 358, in import_app
mod = importlib.import_module(module)
File "/usr/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/opt/osp/app.py", line 70, in <module>
app = Flask(__name__)
File "/usr/lib/python3.8/site-packages/flask/app.py", line 601, in __init__
self.add_url_rule(
File "/usr/lib/python3.8/site-packages/flask/app.py", line 98, in wrapper_func
return f(self, *args, **kwargs)
File "/usr/lib/python3.8/site-packages/flask/app.py", line 1277, in add_url_rule
self.url_map.add(rule)
File "/usr/lib/python3.8/site-packages/werkzeug/routing.py", line 1388, in add
rule.bind(self)
File "/usr/lib/python3.8/site-packages/werkzeug/routing.py", line 730, in bind
self.compile()
File "/usr/lib/python3.8/site-packages/werkzeug/routing.py", line 794, in compile
self._build = self._compile_builder(False).__get__(self, None)
File "/usr/lib/python3.8/site-packages/werkzeug/routing.py", line 951, in _compile_builder
code = compile(module, "<werkzeug routing>", "exec")
TypeError: required field "type_ignores" missing from Module
[2020-01-04 22:17:34 +0800] [54957] [INFO] Worker exiting (pid: 54957)
[2020-01-04 22:17:34 +0800] [54955] [INFO] Shutting down: Master
[2020-01-04 22:17:34 +0800] [54955] [INFO] Reason: Worker failed to boot.
Python 3.8 compatibility for this library is fixed in version 0.15.5, this can be solved manually by doing
pip install werkzeug==0.15.5
for old installations. For new installs editing the setup/requirements.txt
is preferable, since this is a simple edit. I did not bother creating a PR, I can make one if you request though.