0
from django.conf.urls import url, include
from django.views.generic import ListView
from blog.models import Post

urlpatterns = ['',
                url(r'^$', include('blog.urls'),
                 ListView.as_view(
                 queryset=Post.objects.all().order_by('date')[:10],
                 template_name='blog.html')), ]

no idea about this error can someone help

1 Answer 1

3

When you use urlpatterns with a list - which is the only way to do it in 1.10+ - you must not provide an initial pattern prefix argument, which is what you are doing with the empty string there. Remove that completely.

Sign up to request clarification or add additional context in comments.

3 Comments

urlpatterns = ['', url(r'^', ListView.as_view( queryset=Post.objects.all().order_by('date')[:10], template_name='blog.html')), ] i have changed to this still its not working
Er, you didn't change the relevant thing. Remove that first empty string.
urlpatterns = [url(r'^', ListView.as_view( queryset=Post.objects.all().order_by('date')[:10], template_name='blog.html')), ] solved with ur soln thanks roseman

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.