Django 1.4 and NoReverseMatch at / admin / error

I get this error when trying to access my admin panel after upgrading to Django 1.4 - error:

NoReverseMatch at /admin/ Reverse for 'logout' with arguments '()' and keyword arguments '{}' not found. 

My best guess is that I am defining a logout URL that somehow contradicts the one the admin panel is trying to create. Although, it should be creating / admin / logout, right? I upgraded ADMIN_MEDIA_PREFIX to STATIC_URL and moved them to a subfolder named admin, but that didn't seem to change the situation.

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', ) 
+5
source share
1 answer
 (r'^admin/(.*)', include(admin.site.urls)), 

Must be

 (r'^admin/', include(admin.site.urls)), 

(. *) will destroy everything that follows the administrator as an argument to the view.

Also, do you know what causes reverse('logout') ? In my local installation of 1.4, the admin is put in the names and I need to call reverse('admin:logout')

+11
source

All Articles