11import os
2+ from pathlib import Path
23
34import dj_database_url
45from django .contrib import messages
@@ -13,6 +14,7 @@ def user_url(user):
1314
1415
1516PROJECT_ROOT = os .path .join (os .path .dirname (os .path .abspath (__file__ )), os .pardir )
17+ BASE_DIR = Path (__file__ ).resolve ().parent .parent .parent
1618
1719SITE_ID = 1
1820SITE_NAME = "djangosnippets.org"
@@ -68,6 +70,7 @@ def user_url(user):
6870 "theme" ,
6971 "django_recaptcha" ,
7072 "django_extensions" ,
73+ "django_components" ,
7174 "rest_framework" ,
7275 "django_htmx" ,
7376)
@@ -92,7 +95,6 @@ def user_url(user):
9295 {
9396 "BACKEND" : "django.template.backends.django.DjangoTemplates" ,
9497 "DIRS" : [os .path .join (PROJECT_ROOT , "templates" )],
95- "APP_DIRS" : True ,
9698 "OPTIONS" : {
9799 "context_processors" : [
98100 "django.contrib.auth.context_processors.auth" ,
@@ -102,13 +104,29 @@ def user_url(user):
102104 "django.contrib.messages.context_processors.messages" ,
103105 "django.template.context_processors.request" ,
104106 ],
107+ "loaders" : [(
108+ "django.template.loaders.cached.Loader" , [
109+ "django.template.loaders.filesystem.Loader" ,
110+ "django.template.loaders.app_directories.Loader" ,
111+ "django_components.template_loader.Loader" ,
112+ ]
113+ )],
114+ 'builtins' : [
115+ 'django_components.templatetags.component_tags' ,
116+ ],
105117 },
106118 }
107119]
108120
109121STATIC_URL = "/assets/static/"
110122STATIC_ROOT = os .path .join (PROJECT_ROOT , ".." , "assets" , "static" )
111123STATICFILES_DIRS = (os .path .join (PROJECT_ROOT , "static" ),)
124+ STATICFILES_FINDERS = [
125+ "django.contrib.staticfiles.finders.FileSystemFinder" ,
126+ "django.contrib.staticfiles.finders.AppDirectoriesFinder" ,
127+ "django_components.finders.ComponentsFileSystemFinder" ,
128+ ]
129+
112130TAILWIND_APP_NAME = "theme"
113131
114132SESSION_ENGINE = "django.contrib.sessions.backends.cached_db"
0 commit comments