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 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))
|
||||
|
||||
|
@ -51,6 +54,7 @@ INSTALLED_APPS = (
|
|||
|
||||
MIDDLEWARE = [
|
||||
"django.middleware.security.SecurityMiddleware",
|
||||
"whitenoise.middleware.WhiteNoiseMiddleware",
|
||||
"django.contrib.sessions.middleware.SessionMiddleware",
|
||||
"django.middleware.common.CommonMiddleware",
|
||||
#'django.middleware.csrf.CsrfViewMiddleware',
|
||||
|
@ -100,19 +104,20 @@ LOGIN_URL = "/login/"
|
|||
|
||||
LOGOUT_URL = "/logout/"
|
||||
|
||||
# Static files (CSS, JavaScript, Images)
|
||||
# https://docs.djangoproject.com/en/1.8/howto/static-files/
|
||||
MEDIA_URL = "/media/" # https://media.khana.be
|
||||
|
||||
MEDIA_ROOT = os.path.join(BASE_DIR, "media")
|
||||
|
||||
DEFAULT_AUTO_FIELD = "django.db.models.AutoField"
|
||||
|
||||
STATIC_URL = "/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 = {
|
||||
"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
|
||||
Sphinx==3.5.4
|
||||
|
||||
whitenoise==5.3
|
||||
|
||||
gunicorn
|
||||
psycopg2
|
||||
|
|
Loading…
Reference in New Issue