Commit a68b8a4b authored by Florent Chehab's avatar Florent Chehab
Browse files

Merge branch 'clean_django_settings' into 'master'

More robust django settings and removed STATICFILES_DIRS

See merge request !53
parents bee7ef35 aace525b
Pipeline #35526 passed with stages
in 3 minutes and 50 seconds
...@@ -9,10 +9,10 @@ https://docs.djangoproject.com/en/2.0/ref/settings/ ...@@ -9,10 +9,10 @@ https://docs.djangoproject.com/en/2.0/ref/settings/
""" """
import os import os
from os.path import dirname from os.path import dirname, normpath, join
import sys import sys
# Build paths inside the project like this: os.path.join(BASE_DIR, ...) # Build paths inside the project like this: join(BASE_DIR, ...)
# Is the root of the REPOSITORY # Is the root of the REPOSITORY
BASE_DIR = dirname(dirname(dirname(os.path.abspath(__file__)))) BASE_DIR = dirname(dirname(dirname(os.path.abspath(__file__))))
...@@ -58,24 +58,13 @@ if os.environ["ENV"] == "DEV": ...@@ -58,24 +58,13 @@ if os.environ["ENV"] == "DEV":
else: else:
DEBUG = False DEBUG = False
##########
# Webpack loader related
WEBPACK_LOADER = { WEBPACK_LOADER = {
"DEFAULT": { "DEFAULT": {
"BUNDLE_DIR_NAME": "base_app/bundles/", "BUNDLE_DIR_NAME": "base_app/bundles/",
"STATS_FILE": os.path.join(BASE_DIR, "frontend/webpack-stats.json"), "STATS_FILE": join(BASE_DIR, "frontend/webpack-stats.json"),
} }
} }
STATICFILES_DIRS = (
os.path.join(
BASE_DIR, "backend/base_app/static/base_app"
), # We do this so that django's collectstatic copies or our bundles to the STATIC_ROOT or syncs them to whatever storage we use.
)
# End of webpack loader related
###########
ALLOWED_PHOTOS_EXTENSION = ["jpg", "jpeg", "png", "svg"] ALLOWED_PHOTOS_EXTENSION = ["jpg", "jpeg", "png", "svg"]
INTERNAL_IPS = ["127.0.0.1"] INTERNAL_IPS = ["127.0.0.1"]
...@@ -149,7 +138,7 @@ DATABASES = { ...@@ -149,7 +138,7 @@ DATABASES = {
# DATABASES = { # DATABASES = {
# "default": { # "default": {
# "ENGINE": "django.db.backends.sqlite3", # "ENGINE": "django.db.backends.sqlite3",
# "NAME": os.path.join(PROJECT_DIR, "../database.db"), # "NAME": join(PROJECT_DIR, "../database.db"),
# } # }
# } # }
...@@ -178,7 +167,7 @@ USE_L10N = True ...@@ -178,7 +167,7 @@ USE_L10N = True
USE_TZ = True USE_TZ = True
STATIC_URL = "/static/" STATIC_URL = "/static/"
STATIC_ROOT = os.path.join(BASE_DIR, "static") STATIC_ROOT = normpath(join(BASE_DIR, "static"))
MEDIA_ROOT = os.path.join(BASE_DIR, "media") MEDIA_ROOT = normpath(join(BASE_DIR, "media"))
MEDIA_URL = "/media/" MEDIA_URL = "/media/"
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment