diff --git a/.gitignore b/.gitignore index 4f59dd6..74add60 100644 --- a/.gitignore +++ b/.gitignore @@ -154,3 +154,4 @@ cython_debug/ keys htmlcov/ tmp/ +static/ diff --git a/dashboard/settings.py b/dashboard/settings.py index 943ce1b..18716c1 100644 --- a/dashboard/settings.py +++ b/dashboard/settings.py @@ -48,6 +48,7 @@ INSTALLED_APPS = [ MIDDLEWARE = [ "django.middleware.security.SecurityMiddleware", + "whitenoise.middleware.WhiteNoiseMiddleware", "django.contrib.sessions.middleware.SessionMiddleware", "oauth2_provider.middleware.OAuth2TokenMiddleware", "django.middleware.common.CommonMiddleware", @@ -129,10 +130,12 @@ USE_TZ = True # https://docs.djangoproject.com/en/4.0/howto/static-files/ STATIC_URL = "static/" +STATIC_ROOT = BASE_DIR / "static" +# STATICFILES_DIRS = [ +# BASE_DIR / "static", +# ] -STATICFILES_DIRS = [ - BASE_DIR / "static", -] +STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage" # Default primary key field type # https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field diff --git a/docs/INSTALL.md b/docs/INSTALL.md index d31e8a1..ae3a279 100644 --- a/docs/INSTALL.md +++ b/docs/INSTALL.md @@ -9,6 +9,18 @@ configuration file to override [dashboard/settings.py](../dashboard/settings.py) Please copy local_settings.example.py to local_settings.py and make changes to the newly copied file. +## Static files + +In order to serve static files, please run the following command before +running the Dashbaord server: + +```bash +yes yes | python manage.py collectstatic +``` + +This command will gather all static assets from all the modules in +Dashbaord and place them in `static/` in the base directory. + ## Cron jobs Run cron job at an interval of your choosing with the following comamnd: diff --git a/requirements.txt b/requirements.txt index ccdcb32..1aa7e5f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,7 @@ asgiref==3.5.0 astroid==2.9.3 black==22.1.0 +Brotli==1.0.9 certifi==2022.5.18.1 cffi==1.15.0 charset-normalizer==2.0.12 @@ -18,6 +19,7 @@ gitdb==4.0.9 GitPython==3.1.27 greenlet==1.1.2 idna==3.3 +install==1.3.5 isort==5.10.1 jedi==0.18.1 jwcrypto==1.3.1 @@ -45,4 +47,5 @@ tblib==1.7.0 toml==0.10.2 tomli==2.0.1 urllib3==1.26.9 +whitenoise==6.2.0 wrapt==1.13.3