forked from Hostea/dashboard
feat & fix: install and configure whitenoise to serve static files in
prod fixes: https://gitea.hostea.org/Hostea/dashboard/issues/24wip-site
parent
22abe08f68
commit
b4183c1790
|
@ -154,3 +154,4 @@ cython_debug/
|
||||||
keys
|
keys
|
||||||
htmlcov/
|
htmlcov/
|
||||||
tmp/
|
tmp/
|
||||||
|
static/
|
||||||
|
|
|
@ -48,6 +48,7 @@ INSTALLED_APPS = [
|
||||||
|
|
||||||
MIDDLEWARE = [
|
MIDDLEWARE = [
|
||||||
"django.middleware.security.SecurityMiddleware",
|
"django.middleware.security.SecurityMiddleware",
|
||||||
|
"whitenoise.middleware.WhiteNoiseMiddleware",
|
||||||
"django.contrib.sessions.middleware.SessionMiddleware",
|
"django.contrib.sessions.middleware.SessionMiddleware",
|
||||||
"oauth2_provider.middleware.OAuth2TokenMiddleware",
|
"oauth2_provider.middleware.OAuth2TokenMiddleware",
|
||||||
"django.middleware.common.CommonMiddleware",
|
"django.middleware.common.CommonMiddleware",
|
||||||
|
@ -129,10 +130,12 @@ USE_TZ = True
|
||||||
# https://docs.djangoproject.com/en/4.0/howto/static-files/
|
# https://docs.djangoproject.com/en/4.0/howto/static-files/
|
||||||
|
|
||||||
STATIC_URL = "static/"
|
STATIC_URL = "static/"
|
||||||
|
STATIC_ROOT = BASE_DIR / "static"
|
||||||
|
# STATICFILES_DIRS = [
|
||||||
|
# BASE_DIR / "static",
|
||||||
|
# ]
|
||||||
|
|
||||||
STATICFILES_DIRS = [
|
STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"
|
||||||
BASE_DIR / "static",
|
|
||||||
]
|
|
||||||
|
|
||||||
# Default primary key field type
|
# Default primary key field type
|
||||||
# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field
|
# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field
|
||||||
|
|
|
@ -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
|
Please copy local_settings.example.py to local_settings.py and make
|
||||||
changes to the newly copied file.
|
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
|
## Cron jobs
|
||||||
|
|
||||||
Run cron job at an interval of your choosing with the following comamnd:
|
Run cron job at an interval of your choosing with the following comamnd:
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
asgiref==3.5.0
|
asgiref==3.5.0
|
||||||
astroid==2.9.3
|
astroid==2.9.3
|
||||||
black==22.1.0
|
black==22.1.0
|
||||||
|
Brotli==1.0.9
|
||||||
certifi==2022.5.18.1
|
certifi==2022.5.18.1
|
||||||
cffi==1.15.0
|
cffi==1.15.0
|
||||||
charset-normalizer==2.0.12
|
charset-normalizer==2.0.12
|
||||||
|
@ -18,6 +19,7 @@ gitdb==4.0.9
|
||||||
GitPython==3.1.27
|
GitPython==3.1.27
|
||||||
greenlet==1.1.2
|
greenlet==1.1.2
|
||||||
idna==3.3
|
idna==3.3
|
||||||
|
install==1.3.5
|
||||||
isort==5.10.1
|
isort==5.10.1
|
||||||
jedi==0.18.1
|
jedi==0.18.1
|
||||||
jwcrypto==1.3.1
|
jwcrypto==1.3.1
|
||||||
|
@ -45,4 +47,5 @@ tblib==1.7.0
|
||||||
toml==0.10.2
|
toml==0.10.2
|
||||||
tomli==2.0.1
|
tomli==2.0.1
|
||||||
urllib3==1.26.9
|
urllib3==1.26.9
|
||||||
|
whitenoise==6.2.0
|
||||||
wrapt==1.13.3
|
wrapt==1.13.3
|
||||||
|
|
Loading…
Reference in New Issue