1
1
import os
2
+ from pathlib import Path
2
3
3
4
import dj_database_url
4
5
from django .contrib import messages
@@ -13,6 +14,7 @@ def user_url(user):
13
14
14
15
15
16
PROJECT_ROOT = os .path .join (os .path .dirname (os .path .abspath (__file__ )), os .pardir )
17
+ BASE_DIR = Path (__file__ ).resolve ().parent .parent .parent
16
18
17
19
SITE_ID = 1
18
20
SITE_NAME = "djangosnippets.org"
@@ -68,6 +70,7 @@ def user_url(user):
68
70
"theme" ,
69
71
"django_recaptcha" ,
70
72
"django_extensions" ,
73
+ "django_components" ,
71
74
"rest_framework" ,
72
75
"django_htmx" ,
73
76
)
@@ -92,7 +95,6 @@ def user_url(user):
92
95
{
93
96
"BACKEND" : "django.template.backends.django.DjangoTemplates" ,
94
97
"DIRS" : [os .path .join (PROJECT_ROOT , "templates" )],
95
- "APP_DIRS" : True ,
96
98
"OPTIONS" : {
97
99
"context_processors" : [
98
100
"django.contrib.auth.context_processors.auth" ,
@@ -102,13 +104,29 @@ def user_url(user):
102
104
"django.contrib.messages.context_processors.messages" ,
103
105
"django.template.context_processors.request" ,
104
106
],
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
+ ],
105
117
},
106
118
}
107
119
]
108
120
109
121
STATIC_URL = "/assets/static/"
110
122
STATIC_ROOT = os .path .join (PROJECT_ROOT , ".." , "assets" , "static" )
111
123
STATICFILES_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
+
112
130
TAILWIND_APP_NAME = "theme"
113
131
114
132
SESSION_ENGINE = "django.contrib.sessions.backends.cached_db"
0 commit comments