Move the content templates/files into conservancy/content
These were previously intermingled with the static content in `conservancy/static`.
This commit is contained in:
parent
16b2165de7
commit
fe64a26a72
76 changed files with 13 additions and 14 deletions
conservancy
content
GiveUpGitHub
about
activities
copyleft-compliance
about.htmlenforcement-strategy.htmlfirmware-liberation.htmlglossary.htmlhelp.htmlindex.htmllinux-vs-vmkernel_de.pnglinux-vs-vmkernel_de.svglinux-vs-vmkernel_en.pnglinux-vs-vmkernel_en.svglinux-vs-vmkernel_en_scaled.pngpast-lawsuits.htmlprinciples.cn.htmlprinciples.cn.pdfprinciples.htmlprinciples.kr.htmlprinciples.kr.pdfvizio-filing-press-release.htmlvizio.htmlvmware-code-similarity.htmlvmware-lawsuit-appeal.htmlvmware-lawsuit-faq.html
donate
fossy
learn
npoacct
press
privacy-policy
projects
apply
current
index.htmlpolicies
conflict-of-interest-policy.9ed5723d4fa0cd23ff52a8945bd8b82d0b80b590.htmlconflict-of-interest-policy.d477e1b02e2093594db118aaa956da8c93129d58.htmlconflict-of-interest-policy.htmlconservancy-travel-policy.11ae065865d3a0b78bb5f2d894c5f955e49e4f0f.htmlconservancy-travel-policy.3b1bc93469c1bb9ceb479f32c29fd7a8ee3521e3.htmlconservancy-travel-policy.44cea2c1e51c72e115dcceeede92e755a1d41da6.htmlconservancy-travel-policy.4b21de38c2eab014dbfb776460c7600716bd6653.htmlconservancy-travel-policy.676ecf976cff8bf611cc045e6f351ce36f1009bb.htmlconservancy-travel-policy.783dcdd92fc61f3f150e1c65782c0fe527c8ff52.htmlconservancy-travel-policy.96a0a68c8e10ab4ea1f68faaf6573c141bbe7614.htmlconservancy-travel-policy.9ef7fadc65c41438dd5dfeec3544bf80b53e4cea.htmlconservancy-travel-policy.b78549cbc630463374e2bd50db187eedda9b75bd.htmlconservancy-travel-policy.bfc2754decec9bf4b88c10accd4e44b33e4664e6.htmlconservancy-travel-policy.d3640cc7e0181236b3b5a988328ab2ae82cd7c03.htmlconservancy-travel-policy.efb14f1e18273e4f164e3b3a689a086fd511ba26.htmlconservancy-travel-policy.htmlindex.htmlpublish-policy.py
services
sustainer
settings
supporter
urls.pyviews.py
Before ![]() (image error) Size: 177 KiB After ![]() (image error) Size: 177 KiB ![]() ![]() |
Before (image error) Size: 145 KiB After (image error) Size: 145 KiB |
Before ![]() (image error) Size: 171 KiB After ![]() (image error) Size: 171 KiB ![]() ![]() |
Before (image error) Size: 146 KiB After (image error) Size: 146 KiB |
Before ![]() (image error) Size: 152 KiB After ![]() (image error) Size: 152 KiB ![]() ![]() |
|
@ -99,7 +99,6 @@ TEMPLATES = [
|
|||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'DIRS': [
|
||||
BASE_DIR / 'templates',
|
||||
BASE_DIR / 'static',
|
||||
],
|
||||
'APP_DIRS': True,
|
||||
'OPTIONS': {
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
from django.urls import path, re_path
|
||||
from django.urls import path
|
||||
from django.views.generic import TemplateView
|
||||
|
||||
from . import views as supp_views
|
||||
from .. import views as static_views
|
||||
|
||||
urlpatterns = [
|
||||
path('', supp_views.index),
|
||||
path('banner/', TemplateView.as_view(template_name='supporter/banners.html')),
|
||||
path('banners/', TemplateView.as_view(template_name='supporter/banners.html')),
|
||||
re_path(r'', static_views.index),
|
||||
]
|
||||
|
|
|
@ -52,8 +52,9 @@ urlpatterns = [
|
|||
re_path(r'^GiveUpGitHub/', static_views.index),
|
||||
re_path(r'^learn/', static_views.index),
|
||||
re_path(r'^npoacct/', static_views.index, {'fundraiser_sought': 'npoacct'}),
|
||||
re_path(r'^overview/', static_views.index),
|
||||
re_path(r'^overview/', static_views.index), # Unused?
|
||||
re_path(r'^press/', static_views.index),
|
||||
re_path(r'^privacy-policy/', static_views.index),
|
||||
re_path(r'^projects/', static_views.index),
|
||||
re_path(r'^sustainer/', static_views.index),
|
||||
]
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import mimetypes
|
||||
|
||||
from django.conf import settings
|
||||
from django.http import FileResponse, Http404, HttpResponseRedirect
|
||||
from django.template.response import TemplateResponse
|
||||
from django.http import FileResponse, Http404, HttpResponse, HttpResponseRedirect
|
||||
from django.template import RequestContext, Template
|
||||
|
||||
from .local_context_processors import fundgoal_lookup
|
||||
|
||||
|
@ -27,8 +27,7 @@ def index(request, *args, **kwargs):
|
|||
infrastructure. If it finds a file but it's not a template, it will serve
|
||||
the file as-is.
|
||||
"""
|
||||
# The name "static" has no connection to Django staticfiles.
|
||||
base_path = settings.BASE_DIR / 'static'
|
||||
base_path = settings.BASE_DIR / 'content'
|
||||
path = request.path.lstrip('/')
|
||||
if path.endswith('/'):
|
||||
path += 'index.html'
|
||||
|
@ -43,11 +42,13 @@ def index(request, *args, **kwargs):
|
|||
if not is_template:
|
||||
return FileResponse(open(full_path, 'rb'))
|
||||
else:
|
||||
context = kwargs.copy()
|
||||
try:
|
||||
context['fundgoal'] = fundgoal_lookup(kwargs['fundraiser_sought'])
|
||||
kwargs['fundgoal'] = fundgoal_lookup(kwargs['fundraiser_sought'])
|
||||
except KeyError:
|
||||
pass
|
||||
# Maybe this should open() the template file directly so that these
|
||||
# don't have to be included in the global template TEMPLATES.DIRS?
|
||||
return TemplateResponse(request, path, context)
|
||||
# These template are intentionally not in the template loader path, so
|
||||
# we open them directly, rather than using the template loader.
|
||||
with open(full_path) as t:
|
||||
template = Template(t.read())
|
||||
context = RequestContext(request, kwargs)
|
||||
return HttpResponse(template.render(context))
|
||||
|
|
Loading…
Add table
Reference in a new issue