Learning django & python.
Just set up a new site after doing the tutorial. Now for arguments sake say I want to add a bunch of About us, FAQ basic html pages with ve
If you're using the class based views because direct_to_template
has been deprecated, you can create a simple wrapper that renders your own templates directly:
from django.views.generic import TemplateView
from django.template import TemplateDoesNotExist
from django.http import Http404
class StaticView(TemplateView):
def get(self, request, page, *args, **kwargs):
self.template_name = page
response = super(StaticView, self).get(request, *args, **kwargs)
try:
return response.render()
except TemplateDoesNotExist:
raise Http404()
and in your router:
from myapp.static.views import StaticView
urlpatterns = patterns('',
url(r'^(?P.+\.html)$', StaticView.as_view()),
# ...
)