viewflow / django-material

Material Design for Django
http://viewflow.io/
BSD 3-Clause "New" or "Revised" License
2.48k stars 425 forks source link

NoReverseMatch at /admin/logout/ #103

Closed kieusonlam closed 8 years ago

kieusonlam commented 8 years ago

Hi everyone,

I using Django 1.9.4 and Python 2.7.11. I got this error when logging out from admin area.

`Environment:

Request Method: GET Request URL: http://127.0.0.1:8000/admin/logout/

Django Version: 1.9.4 Python Version: 2.7.11 Installed Applications: ['material', 'material.frontend', 'material.admin', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles'] Installed Middleware: ['django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'material.frontend.middleware.SmoothNavigationMiddleware', 'material.frontend.middleware.UnpjaxMiddleware']

Template error: In template D:\Dev\Python\Projects\Django\env\lib\site-packages\material\frontend\templates\registration\logged_out.html, error at line 0 Reverse for 'login' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: [] 1 : {% extends "material/frontend/base_module.html" %} 2 : {% load i18n %} 3 : 4 : 5 : {% block content %} 6 :

7 :
8 :
9 :
10 : {{ title }}

Traceback:

File "D:\Dev\Python\Projects\Django\env\lib\site-packages\django\core\handlers\base.py" in get_response

  1. response = self.process_exception_by_middleware(e, request)

File "D:\Dev\Python\Projects\Django\env\lib\site-packages\django\core\handlers\base.py" in get_response

  1. response = response.render()

File "D:\Dev\Python\Projects\Django\env\lib\site-packages\django\template\response.py" in render

  1. self.content = self.rendered_content

File "D:\Dev\Python\Projects\Django\env\lib\site-packages\django\template\response.py" in rendered_content

  1. content = template.render(context, self._request)

File "D:\Dev\Python\Projects\Django\env\lib\site-packages\django\template\backends\django.py" in render

  1. return self.template.render(context)

File "D:\Dev\Python\Projects\Django\env\lib\site-packages\django\template\base.py" in render

  1. return self._render(context)

File "D:\Dev\Python\Projects\Django\env\lib\site-packages\django\template\base.py" in _render

  1. return self.nodelist.render(context)

File "D:\Dev\Python\Projects\Django\env\lib\site-packages\django\template\base.py" in render

  1. bit = node.render_annotated(context)

File "D:\Dev\Python\Projects\Django\env\lib\site-packages\django\template\base.py" in render_annotated

  1. return self.render(context)

File "D:\Dev\Python\Projects\Django\env\lib\site-packages\django\template\loader_tags.py" in render

  1. return compiled_parent._render(context)

File "D:\Dev\Python\Projects\Django\env\lib\site-packages\django\template\base.py" in _render

  1. return self.nodelist.render(context)

File "D:\Dev\Python\Projects\Django\env\lib\site-packages\django\template\base.py" in render

  1. bit = node.render_annotated(context)

File "D:\Dev\Python\Projects\Django\env\lib\site-packages\django\template\base.py" in render_annotated

  1. return self.render(context)

File "D:\Dev\Python\Projects\Django\env\lib\site-packages\django\template\loader_tags.py" in render

  1. return compiled_parent._render(context)

File "D:\Dev\Python\Projects\Django\env\lib\site-packages\django\template\base.py" in _render

  1. return self.nodelist.render(context)

File "D:\Dev\Python\Projects\Django\env\lib\site-packages\django\template\base.py" in render

  1. bit = node.render_annotated(context)

File "D:\Dev\Python\Projects\Django\env\lib\site-packages\django\template\base.py" in render_annotated

  1. return self.render(context)

File "D:\Dev\Python\Projects\Django\env\lib\site-packages\django\template\loader_tags.py" in render

  1. return compiled_parent._render(context)

File "D:\Dev\Python\Projects\Django\env\lib\site-packages\django\template\base.py" in _render

  1. return self.nodelist.render(context)

File "D:\Dev\Python\Projects\Django\env\lib\site-packages\django\template\base.py" in render

  1. bit = node.render_annotated(context)

File "D:\Dev\Python\Projects\Django\env\lib\site-packages\django\template\base.py" in render_annotated

  1. return self.render(context)

File "D:\Dev\Python\Projects\Django\env\lib\site-packages\django\template\loader_tags.py" in render

  1. result = block.nodelist.render(context)

File "D:\Dev\Python\Projects\Django\env\lib\site-packages\django\template\base.py" in render

  1. bit = node.render_annotated(context)

File "D:\Dev\Python\Projects\Django\env\lib\site-packages\django\template\base.py" in render_annotated

  1. return self.render(context)

File "D:\Dev\Python\Projects\Django\env\lib\site-packages\django\template\defaulttags.py" in render

  1. return nodelist.render(context)

File "D:\Dev\Python\Projects\Django\env\lib\site-packages\django\template\base.py" in render

  1. bit = node.render_annotated(context)

File "D:\Dev\Python\Projects\Django\env\lib\site-packages\django\template\base.py" in render_annotated

  1. return self.render(context)

File "D:\Dev\Python\Projects\Django\env\lib\site-packages\django\template\defaulttags.py" in render

  1. six.reraise(*exc_info)

File "D:\Dev\Python\Projects\Django\env\lib\site-packages\django\template\defaulttags.py" in render

  1. url = reverse(view_name, args=args, kwargs=kwargs, current_app=current_app)

File "D:\Dev\Python\Projects\Django\env\lib\site-packages\django\core\urlresolvers.py" in reverse

  1. return force_text(iri_to_uri(resolver._reverse_with_prefix(view, prefix, _args, *_kwargs)))

File "D:\Dev\Python\Projects\Django\env\lib\site-packages\django\core\urlresolvers.py" in _reverse_with_prefix

  1. (lookup_view_s, args, kwargs, len(patterns), patterns))

Exception Type: NoReverseMatch at /admin/logout/ Exception Value: Reverse for 'login' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []`

Any idea?

kmmbvnr commented 8 years ago

You have included material.frontend to the INSTALLED_APPS.

Do you have url(r'', include(frontend_urls)), in your urls conf?

kieusonlam commented 8 years ago

Yes i did include material.frontend to the INSTALLED_APPS.

INSTALLED_APPS = [ 'material', 'material.frontend', 'material.admin', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'debug_toolbar', 'posts', ]

and this is my urls.py from django.conf.urls import url from django.contrib import admin

urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^$', "posts.views.post_home"), ]

I'm new to Django so am i do anything wrong?

kmmbvnr commented 8 years ago

If you are going to use material.frontend you need to follow the documention and add url(r'', include(frontend_urls)) to yor urls.py file

If you don't need a material.frontend you can just remove it from INSTALLED_APPS