I am getting this error when trying to access my admin panel after updating to Django 1.4 - the error is:
NoReverseMatch at /admin/
Reverse for 'logout' with arguments '()' and keyword arguments '{}' not found.
My best guess is that I'm defining a logout urlpattern which is somehow conflicting with the one the admin panel is trying to create? Although, it should be creating /admin/logout, right? I did update my ADMIN_MEDIA_PREFIX to STATIC_URL and moved them to a sub-folder called admin, but that didn't seem to make a difference.
In my urls.py, I have:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
...
('^logout/$', RedirectView.as_view(url='/login/index.html')),
(r'^login/(?P<path>.*)$', 'django.views.static.serve', {'document_root': '/fullpath/to/media/login'}),
(r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': '/fullpath/to/media/static'}),
(r'^admin/(.*)', include(admin.site.urls)),
)
And in my settings.py, I have:
STATIC_ROOT = '/fullpath/to/myapp/media/static/'
STATIC_URL = '/static/'
INSTALLED_APPS = (
'django.contrib.auth',
...
'django.contrib.admin',
)
(r'^admin/(.*)', include(admin.site.urls)),
Should be
(r'^admin/', include(admin.site.urls)),
(.*) would eat up all anything following admin as the view argument.
Also, do you know what is calling reverse('logout')
? In my local 1.4 install, the admin is namespaced and I have to call reverse('admin:logout')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With