devilry / devilry-django

Devilry project main repository
http://devilry.org
BSD 3-Clause "New" or "Revised" License
51 stars 24 forks source link

Update/remove Gunicorn freeze #1273

Closed torgeirl closed 12 months ago

torgeirl commented 1 year ago

pyproject.toml has freezed Gunicorn to v19.9.*, and that makes Devilry incompatible with django-storages for S3 (includes boto3) when running Python 3.10+:

Error: class uri 'gunicorn.workers.gthread.ThreadWorker' invalid or not found: 

[Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/gunicorn/workers/gthread.py", line 40, in <module>
    from asyncio import selectors
ImportError: cannot import name 'selectors' from 'asyncio' (/usr/local/lib/python3.10/asyncio/__init__.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/gunicorn/util.py", line 135, in load_class
    mod = import_module('.'.join(components))
  File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/usr/local/lib/python3.10/site-packages/gunicorn/workers/gthread.py", line 42, in <module>
    from gunicorn import selectors
  File "/usr/local/lib/python3.10/site-packages/gunicorn/selectors.py", line 11, in <module>
    from collections import namedtuple, Mapping
ImportError: cannot import name 'Mapping' from 'collections' (/usr/local/lib/python3.10/collections/__init__.py)
]

Another possible related issue caused by this is that custom logging for Gunicorn doesn't work for the request time in milliseconds (%(M)s).

Levijatan commented 1 year ago

Could not find any reason why gunicorn where frozen to 19 and could not find any applicable breaking changes inn the gunicorn changelog so upped it to 21.

torgeirl commented 12 months ago

Solved in ae6b54097e5983a90317ffb668e02519bad414a9.