Package: graphite-web Version: 1.1.8-1 Severity: important X-Debbugs-Cc: marco.gro...@ichec.ie
Hi, Following the steps in /usr/share/doc/graphite-web/README.Debian, deploying using apache2 mod_wsgi, lead to the below error. In case the GRAPHITE_SETTINGS_MODULE=local_settings env var is not set, same error can appear using gunicorn or alternative WSGI server. The /etc/graphite/local_settings.py is not found, so the defaults from the graphite/settings.py module are used instead. The current patch aims to load the settings from /etc/graphite/local_settings.py: https://salsa.debian.org/debian-graphite-team/graphite-web/-/blob/f15199db7c84d0ed6b4616b1d2ba66d3ccd94930/debian/patches/settings_debian.patch The problem is that /usr/share/graphite-web/graphite.wsgi is doing an os.environ.setdefault for the GRAPHITE_SETTINGS_MODULE env var: $ grep -n GRAPHITE_SETTINGS_MODULE /usr/share/graphite-web/graphite.wsgi 10:os.environ.setdefault('GRAPHITE_SETTINGS_MODULE', 'graphite.local_settings') # noqa $ And when that env var is fetched in graphite/settings.py, it will always map to 'graphite.local_settings', hence the /etc/graphite/local_settings.py won't be considered: $ grep -n GRAPHITE_SETTINGS_MODULE /usr/lib/python3/dist-packages/graphite/settings.py 235:SETTINGS_MODULE = os.environ.get('GRAPHITE_SETTINGS_MODULE', 'local_settings') $ The /usr/share/graphite-web/graphite.wsgi could be patched to omit the os.environ.setdefault for GRAPHITE_SETTINGS_MODULE, or set it to reference 'local_settings' instead. Regards, Marco /var/log/apache2/graphite-web_error.log {{{ [wsgi:error] Could not import graphite.local_settings, using defaults! [wsgi:error] /usr/lib/python3/dist-packages/graphite/settings.py:359: UserWarning: SECRET_KEY is set to an unsafe default. This should be set in local_settings.py for better security [wsgi:error] warn('SECRET_KEY is set to an unsafe default. This should be set in local_settings.py for better security') [wsgi:error] mod_wsgi (pid=1438): Failed to exec Python script file '/usr/share/graphite-web/graphite.wsgi'. [wsgi:error] mod_wsgi (pid=1438): Exception occurred processing WSGI script '/usr/share/graphite-web/graphite.wsgi'. [wsgi:error] Traceback (most recent call last): [wsgi:error] File "/usr/share/graphite-web/graphite.wsgi", line 15, in <module> [wsgi:error] application = get_wsgi_application() [...] [wsgi:error] FileNotFoundError: [Errno 2] No such file or directory: '/usr/lib/python3/storage/log/webapp/info.log' }}} -- System Information: Debian Release: bookworm/sid APT prefers unstable APT policy: (500, 'unstable') Architecture: amd64 (x86_64) Init: systemd (via /run/systemd/system) Versions of packages graphite-web depends on: ii adduser 3.118 ii python3 3.9.2-3 ii python3-cairo 1.16.2-4+b2 ii python3-cairocffi 1.2.0-1 ii python3-django 2:3.2.7-4 ii python3-django-tagging 1:0.5.0-2 ii python3-pyparsing 2.4.7-1 ii python3-simplejson 3.17.5-1 ii python3-six 1.16.0-2 ii python3-tz 2021.1-1 ii python3-urllib3 1.26.5-1~exp1 ii python3-whisper 1.1.4-2.1 graphite-web recommends no packages. Versions of packages graphite-web suggests: ii graphite-carbon 1.1.7-1 ii libapache2-mod-wsgi-py3 4.7.1-3+b1 pn python3-ldap <none> pn python3-memcache <none> pn python3-mysqldb <none> -- Configuration Files: /etc/graphite/local_settings.py changed [not included] -- no debconf information