6👍
✅
You have to create that IndexView
and import it in your urls.py
.
Currently the interpreter complains since in the urls.py
IndexView
is unknown.
To create a new view you should create a new class in views.py
, something like:
from django.views.generic.base import TemplateView
class IndexView(TemplateView):
template_name = 'index.html'
ps: please read the official Django docs, which is very good!
2👍
The IndexView class is in the boilerplate project’s views file.
C:\…\thinkster-django-angular-boilerplate-release\thinkster_django_angular_boilerplate\views
Copy and paste that content into your project’s views file.
from django.views.decorators.csrf import ensure_csrf_cookie
from django.views.generic.base import TemplateView
from django.utils.decorators import method_decorator
class IndexView(TemplateView):
template_name = 'index.html'
@method_decorator(ensure_csrf_cookie)
def dispatch(self, *args, **kwargs):
return super(IndexView, self).dispatch(*args, **kwargs)
- [Django]-Django run manage.py generates OS error in OS X Yosemite
- [Django]-Whats the correct way to use and refer to a slugfield in a django 1.3
- [Django]-How can i print unhandled exception to the Console instead of the Browser in Django?
- [Django]-AttributeError: 'SigSafeLogger' object has no attribute 'logger'
1👍
in your urls.py
from .views import IndexView
url('^.*$', IndexView.as_view(), name='index'),
(.views or yourProject.views)
in your views.py
do what daveoncode wrote
- [Django]-Django – multiple models(table) in one view
- [Django]-Django modelAdmin __init__ and inlines
Source:stackexchange.com