【问题标题】:ImproperlyConfigured at /配置不当 /
【发布时间】:2013-02-02 20:12:05
【问题描述】:

我在尝试配置我的管理员 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:

)

谢谢。

【问题讨论】:

  • 您已经路由了两次相同的模式 (^admin/.),第二个在 include 参数周围没有引号。我不熟悉在 Django 中设置模式,但这就像拇指酸痛一样。
  • 如果我注释掉 apps.index.view 行,它工作正常。它的工作原理有点奇怪...:/

标签: python django url django-grappelli


【解决方案1】:

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

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-11-22
    • 2013-03-11
    相关资源
    最近更新 更多