graphite-project / graphite-web

A highly scalable real-time graphing system
http://graphite.readthedocs.org/
Apache License 2.0
5.88k stars 1.26k forks source link

[BUG] Support for recent versions of whitenoise #2735

Closed plockaby closed 2 years ago

plockaby commented 2 years ago

Describe the bug Since whitenoise version 4 (released in August 2018) the whitenoise project has not supported the whitenoise.django import. In version 6, released last week, the whitenoise.django module is removed entirely and if whitenoise 6 is installed then graphite does not start.

To Reproduce Steps to reproduce the behavior:

Expected behavior I expect Graphite to support whitenoise or at least not blow up, I guess.

Environment (please complete the following information):

deniszh commented 2 years ago

Hi @plockaby Please note that currently whitenoise pinned to 4.1.4 - https://github.com/graphite-project/graphite-web/commit/65d986e49e5158463e3297123f16fdcb9cd287cd, and if I reading code in https://github.com/graphite-project/graphite-web/blob/19f2155a8902f1dc075d4276d384409f1c006764/webapp/graphite/wsgi.py correctly whitenoise.django import calling only for whitenoise < 3.2 We can support whitenoise > 5 if we drop 2.7 support, which technically we can do soon - latest Django supporting 2.7 became EOL afer April 1, 2020

plockaby commented 2 years ago

D'oh! I'm sorry for the noise. I completely missed that pin. You're welcome to close this if you don't want/need to track this.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

risicle commented 1 year ago

It would be nice if the whitespace-presence checking could be robust to a too-new whitespace being in the python environment, as is done for some other whitespace-related properties @ https://github.com/graphite-project/graphite-web/blob/11d996639ed24499edd9bff55607ed787c316950/webapp/graphite/wsgi.py#L22 .

Currently a modern whitespace being present in the environment will throw a ModuleNotFoundError @ https://github.com/graphite-project/graphite-web/blob/11d996639ed24499edd9bff55607ed787c316950/webapp/graphite/wsgi.py#L34

Note whitenoise.__version__ was removed in 6.0 too (https://github.com/evansd/whitenoise/blob/6d4025ecc44f8a89bddc229035d3a4526f9e2543/docs/changelog.rst#600-2022-02-10) so the attempt at disabling it @ https://github.com/graphite-project/graphite-web/blob/11d996639ed24499edd9bff55607ed787c316950/webapp/graphite/wsgi.py#L30 is doing nothing.

deniszh commented 1 year ago

Hi @risicle ,

Thanks for pointing to that issue! Latest whitenoise dropped not only old Python version but also old Django versions support. So, we can enable it in 1.2.x but for 1.1.x I prefer to fix import error and whitenoise detection only.