urls.py中的缩进错误

时间:2014-02-06 15:55:52

标签: python django

意外缩进(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")),
)

0 个答案:

没有答案