aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKelley Spoon <kelley.spoon@linaro.org>2021-12-16 07:46:42 -0600
committerKelley Spoon <kelley.spoon@linaro.org>2021-12-18 03:21:26 +0000
commit35e8476b3bb1cf1ca4e8d690ba6ae63d530c848d (patch)
tree51165609b41a4c196a1e7e986403eb5a2daa74b0
parent73dbed9ddbec37226fdf97e594107a0710c25c0f (diff)
downloadlinaro-license-protection-35e8476b3bb1cf1ca4e8d690ba6ae63d530c848d.tar.gz
staticfiles: get control of the static files once again
Fix staticfiles so that they are correctly generated by 'collectstatic' regardless of where or how this app is deployed. In this change, let's concentrate all static files in 'license_protected_downloads/static' so that we can clear out STATIC_ROOT ('static') and rebuild it reliably with 'collectstatic'. We also restore the contents of the 'license_protected_downloads/static' directory, and update the unit-test.sh script to call 'collectstatic' on a freshly installed STATIC_ROOT before it runs. Signed-off-by: Kelley Spoon <kelley.spoon@linaro.org> Change-Id: Ice720b4794a48540c3753f4a6efba027cbc29040 Reviewed-on: https://review.linaro.org/c/infrastructure/linaro-license-protection/+/40206
-rw-r--r--.gitignore1
-rw-r--r--settings.py4
-rwxr-xr-xunit-test.sh3
3 files changed, 5 insertions, 3 deletions
diff --git a/.gitignore b/.gitignore
index 0fa93b9..900c06a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,6 @@
.testrepository
licenses.sqlite3
licenses.db
-license_protected_downloads/static
static
*.pyc
*.swp
diff --git a/settings.py b/settings.py
index cb2fd19..996b385 100644
--- a/settings.py
+++ b/settings.py
@@ -66,7 +66,7 @@ MEDIA_URL = ''
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/home/media/media.lawrence.com/static/"
-STATIC_ROOT = os.path.join(PROJECT_ROOT, "license_protected_downloads/static")
+STATIC_ROOT = os.path.join(PROJECT_ROOT, "static")
# URL prefix for static files.
# Example: "http://media.lawrence.com/static/"
@@ -87,7 +87,7 @@ STATICFILES_DIRS = (
# Also:
# - for some reason, django doesn't like this to be "STATIC_ROOT"
# - this must be a tuple, so even if only 1 entry leave a trailing comma
- os.path.join(PROJECT_ROOT, 'static'),
+ os.path.join(PROJECT_ROOT, "license_protected_downloads/static"),
)
# List of finder classes that know how to find static files in
diff --git a/unit-test.sh b/unit-test.sh
index f633587..da7073e 100755
--- a/unit-test.sh
+++ b/unit-test.sh
@@ -18,4 +18,7 @@ if [ -z $VIRTUAL_ENV ] ; then
pip install -r requirements.txt
fi
+rm -rf static/*
+
+DJANGO_SETTINGS_MODULE=settings SKIP_LINT=$SKIP_LINT ./manage.py collectstatic --no-input
DJANGO_SETTINGS_MODULE=settings SKIP_LINT=$SKIP_LINT ./manage.py test license_protected_downloads