python - When used django_tables2, it told me TemplateDoesNotExist -
urls.py
urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^$', views.people), ]
views.py
def people(request): return render(request, 'people.html', {'people': models.person.objects.all()})
models.py
class person(models.model): name = charfield(verbose_name="full name", max_length=10)
people.html
{% load render_table django_tables2 %} {% load static %} {% render_table people %}
when run it, told me templatedoesnotexist @ /django_tables2/table.html
, don't understand why.
first, make sure django_tables2
included in installed_apps
setting.
then, make sure have app_dirs
set true
in templates
setting.
templates = [ { 'backend': 'django.template.backends.django.djangotemplates', 'dirs': [...], 'app_dirs': true, ... }, ]
Comments
Post a Comment