我尝试设置管理工具的基本配置,但由于 url 调度程序识别 admin_tools.urls 的包含而失败:
#urls.py
...
import admin_tools.urls
urlpatterns = patterns('',
url(r'^admintools/', include(admin_tools.urls)),
url(r'^admin/', include(admin.site.urls)),
)
#settings.py
import django.conf.global_settings as DEFAULT_SETTINGS
TEMPLATE_CONTEXT_PROCESSORS = DEFAULT_SETTINGS.TEMPLATE_CONTEXT_PROCESSORS + (
"django.core.context_processors.request",
)
INSTALLED_APPS = (
'django.contrib.auth',
...
'admin_tools',
'admin_tools.menu',
'admin_tools.dashboard',
'django.contrib.admin',
'repmgr',)
我确实运行了syncdb。我确信正则表达式匹配 /admintools/,因为当我包含另一个应用程序时它可以工作。
详细的错误响应是:
Page not found (404)
Request Method: GET
Request URL: http://127.0.0.1:8000/admintools/
Using the URLconf defined in urlconf, Django tried these URL patterns, in this order:
^__debug__/m/(.*)$
^__debug__/sql_select/$ [name='sql_select']
^__debug__/sql_explain/$ [name='sql_explain']
^__debug__/sql_profile/$ [name='sql_profile']
^__debug__/template_source/$ [name='template_source']
^admin/doc/
^admintools/ ^menu/
^admintools/ ^dashboard/
^sthrep/
The current URL, admintools/, didn't match any of these.