From 56b325ca1090b3d3cef30a79a1d2d65f89c5dc19 Mon Sep 17 00:00:00 2001 From: Brian Stephan Date: Mon, 24 Nov 2025 08:28:09 -0600 Subject: [PATCH] use django whitenoise for static files --- .gitignore | 1 + dr_botzo/settings.py | 4 ++++ pyproject.toml | 2 +- requirements/requirements-dev.txt | 2 ++ requirements/requirements.txt | 2 ++ 5 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index c2e1817..127f7a5 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ tags/ *.egg-info/ .tox/ .coverage +staticfiles/ dr.botzo.data dr.botzo.cfg localsettings.py diff --git a/dr_botzo/settings.py b/dr_botzo/settings.py index 426a5f4..0bbbcda 100644 --- a/dr_botzo/settings.py +++ b/dr_botzo/settings.py @@ -54,6 +54,7 @@ INSTALLED_APPS = [ MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', + 'whitenoise.middleware.WhiteNoiseMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', @@ -165,6 +166,9 @@ BOOTSTRAP3 = { 'javascript_in_head': True, } +# whitenoise +STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') + ############### # web options # ############### diff --git a/pyproject.toml b/pyproject.toml index ed3f8ce..6eb8ec6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,7 +12,7 @@ authors = [ ] requires-python = ">=3.10,<3.12" dependencies = ["Django<5.1", "django-bootstrap3", "django-extensions", "djangorestframework", "irc<20.5.0", "numexpr", - "parsedatetime", "ply", "python-dateutil", "python-mpd2", "pytz", "requests", "zalgo-text"] + "parsedatetime", "ply", "python-dateutil", "python-mpd2", "pytz", "requests", "whitenoise", "zalgo-text"] dynamic = ["version"] classifiers = [ "Framework :: Django", diff --git a/requirements/requirements-dev.txt b/requirements/requirements-dev.txt index ede22fd..b51af51 100644 --- a/requirements/requirements-dev.txt +++ b/requirements/requirements-dev.txt @@ -283,6 +283,8 @@ virtualenv==20.27.1 # via tox wheel==0.44.0 # via pip-tools +whitenoise==6.11.0 + # via dr.botzo (pyproject.toml) zalgo-text==0.6 # via dr.botzo (pyproject.toml) diff --git a/requirements/requirements.txt b/requirements/requirements.txt index d921533..f6497c8 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -83,5 +83,7 @@ tempora==5.7.0 # jaraco-logging urllib3==2.2.3 # via requests +whitenoise==6.11.0 + # via dr.botzo (pyproject.toml) zalgo-text==0.6 # via dr.botzo (pyproject.toml)