diff --git a/.gitignore b/.gitignore index 2186486..e92afa4 100644 --- a/.gitignore +++ b/.gitignore @@ -214,3 +214,4 @@ dmypy.json # End of https://www.gitignore.io/api/node,python env/ +collected-static diff --git a/requirements.txt b/requirements.txt index 039a19a..4657a31 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1,4 @@ django==3.0.5 django-debug-toolbar==2.2 +whitenoise==5.0.1 +brotli==1.0.7 diff --git a/website/settings.py b/website/settings.py index 9a77534..6fc5a0c 100644 --- a/website/settings.py +++ b/website/settings.py @@ -30,10 +30,15 @@ ALLOWED_HOSTS = "*" # Application definition -INSTALLED_APPS = ["django.contrib.staticfiles", "debug_toolbar"] +INSTALLED_APPS = [ + "whitenoise.runserver_nostatic", + "django.contrib.staticfiles", + "debug_toolbar", +] MIDDLEWARE = [ "django.middleware.security.SecurityMiddleware", + "whitenoise.middleware.WhiteNoiseMiddleware", "django.middleware.common.CommonMiddleware", "django.middleware.csrf.CsrfViewMiddleware", "django.middleware.clickjacking.XFrameOptionsMiddleware", @@ -72,6 +77,8 @@ USE_TZ = True # https://docs.djangoproject.com/en/3.0/howto/static-files/ STATIC_URL = "/static/" +STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage" +STATIC_ROOT = os.path.join(BASE_DIR, "collected-static") INTERNAL_IPS = [