2013-02-02 40 views
0

我收到錯誤信息,當我嘗試配置管理員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: 

) 

謝謝。

+0

您已經路由了相同的模式兩次('^ admin/.'),並且第二個引號沒有圍繞include參數。我對在Django中設置模式並不熟悉,但它像拇指一樣突出顯示。 –

+0

如果我將apps.index.view行註釋掉,它會正常工作。它有點奇怪它是如何工作的......:/ – user805981

回答

1

這是我urlconf我還使用grampelli和工作正常,

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

我建議你使用django-boilerplate擺脫這個小配置問題的。