在/处配置不当

时间:2013-02-02 20:12:06

标签: python django url django-grappelli

当我尝试配置管理员grappelli时,我收到了错误消息。 每当我的索引被注释掉时,管理页面都可以正常工作。但是当取消注释时,它会在/ admin /中给出错误配置错误。那我该如何配置管理员?

from django.conf.urls.defaults import *
from django.views.static import *

# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
    (r'^admin/', include('apps.grappelli.urls')),
    (r'^admin/', include(admin.site.urls)),
    (r'^$', include('apps.index.views')),

    # Examples:
    #(r'^blog/', include('apps.blog.views')),

    # Uncomment the admin/doc line below to enable admin documentation:
    #(r'^admin/doc/', include('django.contrib.admindocs.urls')),

    # Uncomment the next line to enable the admin:

)

感谢。

1 个答案:

答案 0 :(得分:1)

这是我urlconf我也在使用grampelli并且工作正常,

urlpatterns = patterns('',
    url(r'^admin/', include(admin.site.urls)),
    url(r'^grappelli/', include('grappelli.urls')),

我建议你使用django-boilerplate来摆脱这个小配置问题。