意外缩进(urls.py,第1行) 这是代码
mysite/urls.py
from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Examples:
# url(r'^$', 'mysite.views.home', name='home'),
#url(r'^mysite/', include('mysite.foo.urls')),
url(r'^admin/', include(admin.site.urls)),
url(r'^blog/', include('blog.urls')),
)
我正在创建一个网站并在我的mysite / urls.py中遇到此错误,这里是我的代码
mysite/blog/urls.py
from django.conf.urls import patterns,url
from django.views.generic import ListView
from blog.models import Post
urlpatterns = patterns('',
url(r'^',ListView.as_view(
queryset=Post.objects.all().order_by("-date")[:10],
template_name="blog.html")),
)