我有一个基于 Django Photologue 的网络应用程序。我想添加一些更改(对网络的访问受限)。我创建了一个新应用程序,photologue_custom
并按照示例(示例)做了其他事情。但我有错误:“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
请帮我。