feat & fix: install and configure whitenoise to serve static files in
ci/woodpecker/push/woodpecker Pipeline failed Details

prod

fixes: https://gitea.hostea.org/Hostea/dashboard/issues/24
pull/19/head
Aravinth Manivannan 2022-07-07 10:59:23 +05:30
parent 22abe08f68
commit b4183c1790
Signed by: realaravinth
GPG Key ID: AD9F0F08E855ED88
4 changed files with 22 additions and 3 deletions

1
.gitignore vendored
View File

@ -154,3 +154,4 @@ cython_debug/
keys
htmlcov/
tmp/
static/

View File

@ -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

View File

@ -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:

View File

@ -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