Skip to content

Commit 7c0be60

Browse files
Fix include_static to check STATIC_URL attribute existence
1 parent 1d0a8cc commit 7c0be60

File tree

1 file changed

+4
-19
lines changed

1 file changed

+4
-19
lines changed

src/raystack/__init__.py

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -66,34 +66,19 @@ def include_routers(self):
6666
logger.warning(f"⚠️ '{app_path}.router'")
6767

6868
def include_templates(self):
69-
# Connect internal Raystack templates (e.g., admin templates)
70-
internal_template_dirs = [
71-
os.path.join(self.raystack_directory, "contrib", "templates")
72-
]
73-
for template in self.settings.TEMPLATES:
74-
# Add internal templates to user template directories
75-
template_dirs = template.get("DIRS", [])
76-
# Convert relative paths to absolute
77-
template_dirs = [os.path.join(self.settings.BASE_DIR, path) for path in template_dirs]
78-
# Add internal templates if not already present
79-
for internal_dir in internal_template_dirs:
80-
if internal_dir not in template_dirs:
81-
template_dirs.append(internal_dir)
82-
template["DIRS"] = template_dirs
69+
# Templates are now project-specific, not part of framework
70+
# Projects should configure TEMPLATES['DIRS'] in their settings
71+
pass
8372

8473
def include_static(self):
85-
# Include framework static files
86-
internal_static_dir = os.path.join(self.raystack_directory, "contrib", "static")
87-
self.mount("/admin_static", StaticFiles(directory=internal_static_dir), name="admin_static")
88-
8974
# Include static files from STATICFILES_DIRS
9075
if hasattr(self.settings, 'STATICFILES_DIRS') and self.settings.STATICFILES_DIRS:
9176
for static_dir in self.settings.STATICFILES_DIRS:
9277
if os.path.exists(static_dir):
9378
self.mount("/static", StaticFiles(directory=static_dir), name="static")
9479
break # Mount only the first existing directory
9580
# Fallback to default static directory
96-
elif self.settings.STATIC_URL:
81+
elif hasattr(self.settings, 'STATIC_URL') and self.settings.STATIC_URL:
9782
static_dir = os.path.join(self.settings.BASE_DIR, self.settings.STATIC_URL)
9883
if os.path.exists(static_dir):
9984
self.mount("/static", StaticFiles(directory=static_dir), name="static")

0 commit comments

Comments
 (0)