Reputation: 9615
I am confused as to how to use the TemplateView in Django 1.6.
The HTML Looks like this:
<li><a href="/solutions">Solutions</a></li>
My urls.py looks like this:
url(r'^/solutions$', solutions.as_view(), name='solutions'),
And the (entire) solutions views.py looks like this:
class solutions(TemplateView):
template_name = "solutions.html"
Yet I still receive a 404 error when going to www.mysite.com/solutions. I can give the entire traceback upon request. But I am sure I am doing something fundamentally wrong.
Upvotes: 1
Views: 286
Reputation: 9084
Basically your url regex should not start with '/'. It should be :
url(r'^solutions/$', solutions.as_view(), name='solutions')
This would work. You can find more about Naming URL patterns here : https://docs.djangoproject.com/en/1.6/topics/http/urls/#naming-url-patterns
Upvotes: 2