Enable whitenoise to serve static files
This commit is contained in:
parent
3d919c7edf
commit
f057380fdb
|
@ -13,7 +13,10 @@ https://docs.djangoproject.com/en/1.8/ref/settings/
|
||||||
import os
|
import os
|
||||||
import environ
|
import environ
|
||||||
|
|
||||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
from pathlib import Path
|
||||||
|
|
||||||
|
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||||
|
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||||
|
|
||||||
env = environ.Env(DEBUG=(bool, False))
|
env = environ.Env(DEBUG=(bool, False))
|
||||||
|
|
||||||
|
@ -51,6 +54,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",
|
||||||
"django.middleware.common.CommonMiddleware",
|
"django.middleware.common.CommonMiddleware",
|
||||||
#'django.middleware.csrf.CsrfViewMiddleware',
|
#'django.middleware.csrf.CsrfViewMiddleware',
|
||||||
|
@ -100,19 +104,20 @@ LOGIN_URL = "/login/"
|
||||||
|
|
||||||
LOGOUT_URL = "/logout/"
|
LOGOUT_URL = "/logout/"
|
||||||
|
|
||||||
# Static files (CSS, JavaScript, Images)
|
MEDIA_URL = "/media/" # https://media.khana.be
|
||||||
# https://docs.djangoproject.com/en/1.8/howto/static-files/
|
|
||||||
|
MEDIA_ROOT = os.path.join(BASE_DIR, "media")
|
||||||
|
|
||||||
|
DEFAULT_AUTO_FIELD = "django.db.models.AutoField"
|
||||||
|
|
||||||
STATIC_URL = "/static/"
|
STATIC_URL = "/static/"
|
||||||
|
|
||||||
STATICFILES_DIRS = (os.path.join(BASE_DIR, "static"),)
|
STATICFILES_DIRS = (os.path.join(BASE_DIR, "static"),)
|
||||||
|
|
||||||
MEDIA_URL = "/media/" # https://media.khana.be
|
STATIC_ROOT = BASE_DIR / 'staticfiles'
|
||||||
|
|
||||||
MEDIA_ROOT = os.path.join(BASE_DIR, "media")
|
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
|
||||||
|
|
||||||
DEBUG_TOOLBAR_CONFIG = {
|
DEBUG_TOOLBAR_CONFIG = {
|
||||||
"JQUERY_URL": STATIC_URL + "js/jquery-2.1.4.min.js",
|
"JQUERY_URL": STATIC_URL + "js/jquery-2.1.4.min.js",
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFAULT_AUTO_FIELD = "django.db.models.AutoField"
|
|
||||||
|
|
|
@ -10,5 +10,7 @@ reportlab==3.5.67
|
||||||
simplejson==3.17.2
|
simplejson==3.17.2
|
||||||
Sphinx==3.5.4
|
Sphinx==3.5.4
|
||||||
|
|
||||||
|
whitenoise==5.3
|
||||||
|
|
||||||
gunicorn
|
gunicorn
|
||||||
psycopg2
|
psycopg2
|
||||||
|
|
Loading…
Reference in New Issue