feat(settings): Update

This commit is contained in:
Tom Hubrecht 2024-07-03 14:36:57 +02:00
parent 4b354d3d8f
commit f31ca3f45a
2 changed files with 26 additions and 5 deletions

View file

@ -13,6 +13,8 @@ credentials = Credentials(env_prefix="CE_")
# Build paths inside the project like this: BASE_DIR / "subdir". # Build paths inside the project like this: BASE_DIR / "subdir".
BASE_DIR = Path(__file__).resolve().parent.parent BASE_DIR = Path(__file__).resolve().parent.parent
LOCAL_DIR = BASE_DIR / "cas_eleves"
# WARNING: keep the secret key used in production secret! # WARNING: keep the secret key used in production secret!
SECRET_KEY = credentials["SECRET_KEY"] SECRET_KEY = credentials["SECRET_KEY"]
@ -33,7 +35,7 @@ INSTALLED_APPS = [
"django.contrib.sessions", "django.contrib.sessions",
"django.contrib.messages", "django.contrib.messages",
"django.contrib.staticfiles", "django.contrib.staticfiles",
# "cas_eleves", "bulma",
"cas_server", "cas_server",
] ]
@ -62,7 +64,7 @@ ROOT_URLCONF = "app.urls"
TEMPLATES = [ TEMPLATES = [
{ {
"BACKEND": "django.template.backends.django.DjangoTemplates", "BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [(BASE_DIR / "cas_eleves" / "templates")], "DIRS": [LOCAL_DIR / "templates"],
"APP_DIRS": True, "APP_DIRS": True,
"OPTIONS": { "OPTIONS": {
"context_processors": [ "context_processors": [
@ -85,7 +87,7 @@ CAS_WARN_TEMPLATE = "cas_eleves/warn.html"
# -> https://docs.djangoproject.com/en/4.2/howto/static-files/ # -> https://docs.djangoproject.com/en/4.2/howto/static-files/
STATIC_URL = "/static/" STATIC_URL = "/static/"
STATICFILES_DIRS = [BASE_DIR / "cas_eleves" / "static"] STATICFILES_DIRS = [LOCAL_DIR / "static"]
STATIC_ROOT = credentials.get("STATIC_ROOT") STATIC_ROOT = credentials.get("STATIC_ROOT")
@ -142,7 +144,7 @@ USE_I18N = True
USE_L10N = True USE_L10N = True
USE_TZ = True USE_TZ = True
LOCALE_PATHS = [(BASE_DIR / "cas_eleves" / "locale")] LOCALE_PATHS = [LOCAL_DIR / "locale"]
### ###
# Logging configuration # Logging configuration
@ -185,3 +187,15 @@ CAS_SHOW_SERVICE_MESSAGES = False
CAS_NEW_VERSION_EMAIL_WARNING = False CAS_NEW_VERSION_EMAIL_WARNING = False
CAS_NEW_VERSION_HTML_WARNING = False CAS_NEW_VERSION_HTML_WARNING = False
###
# Development configuration
if DEBUG:
INSTALLED_APPS += [
"django_browser_reload",
]
MIDDLEWARE += [
"django_browser_reload.middleware.BrowserReloadMiddleware",
]

View file

@ -15,10 +15,17 @@ Including another URLconf
""" """
import cas_server.urls import cas_server.urls
from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin from django.contrib import admin
from django.urls import include, path from django.urls import include, path
urlpatterns = [ urlpatterns = [
path("admin/", admin.site.urls),
path("", include(cas_server.urls, namespace="cas_server")), path("", include(cas_server.urls, namespace="cas_server")),
] ]
if settings.DEBUG:
urlpatterns += [
path("admin/", admin.site.urls),
path("__reload__/", include("django_browser_reload.urls")),
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)