rhoerbe
rhoerbe

Reputation: 593

Admin Tools config throws 404: page not found

I try to setup the basic configuration of admin tools and fail with the url dispatcher recognizing the include of 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',)

I did run syncdb. I am sure that the regexp matches /admintools/, because it works when I include another app.

The detailed error response is:

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.

Upvotes: 2

Views: 1332

Answers (1)

pistache
pistache

Reputation: 6203

The error message is perfectly correct :

Django tells that there is no URL pattern matching ^admintools/^. That is true. This is because django-admin-tools does not create a different admin site, but rather extends the original admin site.

The ^admintools/ pattern is only created for its sub-patterns, that provide access to pages needed by admin-tools to work well (new pages added to the original admin, for example).

By the way, in django-admin-tools documentation, at the end of the setup instructions, they say :

Congrats! At this point you should have a working installation of django-admin-tools. Now you can just login to your admin site and see what changed.

I guess that by your admin site they mean the standard admin site.

So I think that the good way to access your admin interface and menus and dashboards is using the standard admin.

Upvotes: 2

Related Questions