0

I've a little problem with my urls and I searched for some times but didnt found a correct answer.

I get the following error:

NoReverseMatch at /base/teams/
Reverse for 'base-home' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []

Here is my urls:

  • from the project:

    from django.conf.urls import url, patterns, include
    from django.contrib import admin
    
    urlpatterns = patterns('',
    # Examples:
    
    url(r'^base/$', include('django.contrib.flatpages.urls'), name='base-home'),
    url(r'^base/contact/$', include('django.contrib.flatpages.urls'), name='base-contact'),
    url(r'^base/teams/', include('app.urls'), name='base-teams'),
    
    # Uncomment the admin/doc line below to enable admin documentation:
    # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
    
    # Uncomment the next line to enable the admin:
    url(r'^admin/', include(admin.site.urls)),
    )
    
  • from the app:

    from django.conf.urls import *
    urlpatterns = patterns('',
      url(r'^$', 'app.views.teams_list', name='teams'),
      url(r'^(?P<slug>[-\w\d]+)/$', 'app.views.teams_list', name='teams_slug'),
      url(r'^show/(?P<id>\d+)/$', 'app.views.show_personne', name='show_personne'),
    )
    

Here is the call in the template:

<a class="navbar-brand" href="{% url 'base-home' %}">Website</a>

This error is raised when is try to load the page 'base/teams/'. I don't understand why he doesn't match the base-home view name ...

Thanks for your help, dg

deniden
  • 3
  • 1

1 Answers1

1

That would be because this line

url(r'^base/$', include('django.contrib.flatpages.urls'), name='base-home'),

doesn't actually resolve to a view. Instead it is an include statement.

See How can I get the reverse url for a Django Flatpages template

Community
  • 1
  • 1
kdopen
  • 8,032
  • 7
  • 44
  • 52