我有一个基于Django Photologue构建的网络应用程序。我想添加一些更改(对Web的访问受限)。我创建了一个新的应用程序photologue_custom
,并在示例(example)中执行了其他操作。但我有错误:" TemplateDoesNotExist at ...没有提供模板名称"。
**urls.py at photologue_custom**
urlpatterns = [
url(r'^gallerylist/$',
CustomGalleryListView.as_view(),
name='gallery-list'),
]
**views.py at photologue_custom**
class CustomGalleryListView(ListView):
def get_queryset(self):
if not self.request.user.is_authenticated():
print ("User not authenticated")
return HttpResponseRedirect('/')
else:
print ("User authenticated")
return Gallery.objects.on_site().is_public()
paginate_by = 20
**settings.py**
'DIRS': [os.path.join(BASE_DIR, 'mysite/templates', ), ],
路径:
/home/celinaitomek/wedding-gallery/mysite -> my app
/home/celinaitomek/wedding-gallery/photologue -> photologue
/home/celinaitomek/wedding-gallery/photologue_custom/urls.py -> photologue_custom
没有自定义它可以正常工作:
**urls.py at photologue**
url(r'^gallerylist/$',
GalleryListView.as_view(),
name='gallery-list'),
**views.py at photologue**
class GalleryListView(ListView):
queryset = Gallery.objects.on_site().is_public()
paginate_by = 20
请帮帮我。