diff --git a/app/settings.py b/app/settings.py index e7ff10d..e3052e3 100644 --- a/app/settings.py +++ b/app/settings.py @@ -13,6 +13,8 @@ credentials = Credentials(env_prefix="CE_") # Build paths inside the project like this: BASE_DIR / "subdir". BASE_DIR = Path(__file__).resolve().parent.parent +LOCAL_DIR = BASE_DIR / "cas_eleves" + # WARNING: keep the secret key used in production secret! SECRET_KEY = credentials["SECRET_KEY"] @@ -33,7 +35,7 @@ INSTALLED_APPS = [ "django.contrib.sessions", "django.contrib.messages", "django.contrib.staticfiles", - # "cas_eleves", + "bulma", "cas_server", ] @@ -62,7 +64,7 @@ ROOT_URLCONF = "app.urls" TEMPLATES = [ { "BACKEND": "django.template.backends.django.DjangoTemplates", - "DIRS": [(BASE_DIR / "cas_eleves" / "templates")], + "DIRS": [LOCAL_DIR / "templates"], "APP_DIRS": True, "OPTIONS": { "context_processors": [ @@ -85,7 +87,7 @@ CAS_WARN_TEMPLATE = "cas_eleves/warn.html" # -> https://docs.djangoproject.com/en/4.2/howto/static-files/ STATIC_URL = "/static/" -STATICFILES_DIRS = [BASE_DIR / "cas_eleves" / "static"] +STATICFILES_DIRS = [LOCAL_DIR / "static"] STATIC_ROOT = credentials.get("STATIC_ROOT") @@ -142,7 +144,7 @@ USE_I18N = True USE_L10N = True USE_TZ = True -LOCALE_PATHS = [(BASE_DIR / "cas_eleves" / "locale")] +LOCALE_PATHS = [LOCAL_DIR / "locale"] ### # Logging configuration @@ -185,3 +187,15 @@ CAS_SHOW_SERVICE_MESSAGES = False CAS_NEW_VERSION_EMAIL_WARNING = False CAS_NEW_VERSION_HTML_WARNING = False + +### +# Development configuration + +if DEBUG: + INSTALLED_APPS += [ + "django_browser_reload", + ] + + MIDDLEWARE += [ + "django_browser_reload.middleware.BrowserReloadMiddleware", + ] diff --git a/app/urls.py b/app/urls.py index cf36d7b..327af81 100644 --- a/app/urls.py +++ b/app/urls.py @@ -15,10 +15,17 @@ Including another URLconf """ import cas_server.urls +from django.conf import settings +from django.conf.urls.static import static from django.contrib import admin from django.urls import include, path urlpatterns = [ - path("admin/", admin.site.urls), 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)