Update the path to templates in index()

This commit is contained in:
Ben Sturmfels 2024-03-06 19:02:00 +11:00
parent dd27742114
commit 9fecb37c61
Signed by: bsturmfels
GPG key ID: 023C05E2C9C068F0

View file

@ -6,6 +6,9 @@ from django.template.response import TemplateResponse
from .local_context_processors import fundgoal_lookup
# This component doesn't actually have anything to do with Django's
# "staticfiles" app. It's only that its templates happen to be located in the
# STATIC_ROOT directory. They probably shouldn't be there.
STATIC_ROOT = os.path.abspath(os.path.dirname(__file__))
FILESYSTEM_ENCODING = 'utf-8'
@ -33,7 +36,7 @@ def index(request, *args, **kwargs):
path = request.path.lstrip('/')
if path.endswith('/'):
path += 'index.html'
fullpath = os.path.join(STATIC_ROOT, path)
fullpath = os.path.join(STATIC_ROOT, 'static', path)
try:
# Junk URLs in production (Python 3.5) are causing UnicodeEncodeErrors
# here. Can't reproduce in development in Python 3.9 - only Python 2.7.