From a88d9c7986ceb2a6605a0847ac73e51fd257c8e0 Mon Sep 17 00:00:00 2001 From: Matthias Date: Tue, 20 Apr 2021 18:36:51 +0200 Subject: [PATCH 1/5] Manifeststorage as suggested in #1485 --- InvenTree/InvenTree/settings.py | 1 + 1 file changed, 1 insertion(+) diff --git a/InvenTree/InvenTree/settings.py b/InvenTree/InvenTree/settings.py index 53dcb47037..1e45c80425 100644 --- a/InvenTree/InvenTree/settings.py +++ b/InvenTree/InvenTree/settings.py @@ -189,6 +189,7 @@ STATIC_ROOT = os.path.abspath( STATICFILES_DIRS = [ os.path.join(BASE_DIR, 'InvenTree', 'static'), ] +STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.ManifestStaticFilesStorage' # Translated Template settings STATICFILES_I18_PREFIX = 'i18n' From fdf3e3a3332d855f8b6740886f63fa1d43887135 Mon Sep 17 00:00:00 2001 From: Matthias Date: Tue, 20 Apr 2021 18:45:59 +0200 Subject: [PATCH 2/5] added expiry headers to nginx-docker #1485 --- docker/nginx.conf | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docker/nginx.conf b/docker/nginx.conf index ace56165aa..7f275b4fa8 100644 --- a/docker/nginx.conf +++ b/docker/nginx.conf @@ -27,6 +27,11 @@ server { location /static/ { alias /var/www/static/; autoindex on; + + # Caching settings + expires 30d; + add_header Pragma public; + add_header Cache-Control "public"; } } \ No newline at end of file From 5a7f83798ef2754e2cbc7a9c802957153f7f8cf0 Mon Sep 17 00:00:00 2001 From: Matthias Date: Tue, 20 Apr 2021 18:46:35 +0200 Subject: [PATCH 3/5] docker-start - collect static js #1485 --- docker/start_dev_server.sh | 1 + docker/start_prod_server.sh | 1 + 2 files changed, 2 insertions(+) diff --git a/docker/start_dev_server.sh b/docker/start_dev_server.sh index 703d577ed5..481da3c31a 100644 --- a/docker/start_dev_server.sh +++ b/docker/start_dev_server.sh @@ -39,6 +39,7 @@ echo "Running InvenTree database migrations and collecting static files..." python manage.py check || exit 1 python manage.py migrate --noinput || exit 1 python manage.py migrate --run-syncdb || exit 1 +python manage.py prerender || exit 1 python manage.py collectstatic --noinput || exit 1 python manage.py clearsessions || exit 1 diff --git a/docker/start_prod_server.sh b/docker/start_prod_server.sh index 1fc8f6d111..811e189d13 100644 --- a/docker/start_prod_server.sh +++ b/docker/start_prod_server.sh @@ -39,6 +39,7 @@ echo "Running InvenTree database migrations and collecting static files..." python manage.py check || exit 1 python manage.py migrate --noinput || exit 1 python manage.py migrate --run-syncdb || exit 1 +python manage.py prerender || exit 1 python manage.py collectstatic --noinput || exit 1 python manage.py clearsessions || exit 1 From 6c296e138460421163e9c697b603a8f9e777ecf1 Mon Sep 17 00:00:00 2001 From: Matthias Mair <66015116+matmair@users.noreply.github.com> Date: Tue, 20 Apr 2021 19:28:12 +0200 Subject: [PATCH 4/5] added collection-step to coverage --- .github/workflows/coverage.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/coverage.yaml b/.github/workflows/coverage.yaml index 2b883490d2..9170a83344 100644 --- a/.github/workflows/coverage.yaml +++ b/.github/workflows/coverage.yaml @@ -31,6 +31,7 @@ jobs: sudo apt-get update pip3 install invoke invoke install + invoke static - name: Coverage Tests run: | invoke coverage From ee64f1086f66da4ac6112bda9040674803681625 Mon Sep 17 00:00:00 2001 From: Matthias Date: Wed, 21 Apr 2021 15:04:04 +0200 Subject: [PATCH 5/5] removing manifest-storage for now, has issues --- InvenTree/InvenTree/settings.py | 1 - 1 file changed, 1 deletion(-) diff --git a/InvenTree/InvenTree/settings.py b/InvenTree/InvenTree/settings.py index 1c7180fd4b..4e9ed35748 100644 --- a/InvenTree/InvenTree/settings.py +++ b/InvenTree/InvenTree/settings.py @@ -192,7 +192,6 @@ STATIC_ROOT = os.path.abspath( STATICFILES_DIRS = [ os.path.join(BASE_DIR, 'InvenTree', 'static'), ] -STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.ManifestStaticFilesStorage' # Translated Template settings STATICFILES_I18_PREFIX = 'i18n'