(urls.W005) The URL namespace 'LnkIn' is not unique.

Hi, I get this error when doing my migrations or using the python manage.py runserver .

 (urls.W005) URL namespace 'LnkIn' isn't unique.You may not be able to reverse all URLs in this namespace. 

This is how I have urls.py inside my application directory (LnkIn).

 from django.conf.urls import url from . import views app_name = 'LnkdIn' urlpatterns = [ url(r'^$', views.index, name='index'), url(r'^register/$', views.register, name='register'), url(r'^login_user/$', views.login_user, name='login_user'), url(r'^logout_user/$', views.logout_user, name='logout_user'), url(r'^(?P<user_id>[0-9]+)/$', views.profile, name='profile'), url(r'^(?P<song_id>[0-9]+)/favorite/$', views.favorite, name='favorite'), url(r'^trabajos/$', views.trabajos, name='trabajos'), url(r'^crear_oferta/$', views.crear_oferta, name='crear_oferta'), url(r'^(?P<user_id>[0-9]+)/create_trabajo/$', views.create_trabajo, name='create_trabajo'), url(r'^(?P<user_id>[0-9]+)/crear_amistad/$', views.crear_amistad, name='crear_amistad'), url(r'^(?P<user_id>[0-9]+)/delete_trabajo/(?P<trabajo_id>[0-9]+)/$', views.delete_trabajo, name='delete_trabajo'), url(r'^(?P<album_id>[0-9]+)/favorite_album/$', views.favorite_album, name='favorite_album'), url(r'^(?P<album_id>[0-9]+)/delete_album/$', views.delete_album, name='delete_album'), ] 

And this is how I have urls.py in my main directory.

 from django.conf.urls import include, url from django.contrib import admin from django.conf import settings from django.conf.urls.static import static urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^LnkdIn/', include('LnkdIn.urls')), url(r'^', include('LnkdIn.urls')), ] if settings.DEBUG: urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) 

I really don't know what I could have done wrong. I checked in my views and in my templates, and everything seems to be in order, I don't seem to have typos in my URLs. I am looking, but not found this error, I seem to be like one, and they suggest checking if the URLs are wrong.

I am using Python 2.7 and Django 1.10.

+5
source share
1 answer

You import LnkdIn.urls twice into your urlpatterns application.

You only need to do this once, so select one of the sections below

 url(r'^LnkdIn/', include('LnkdIn.urls')), 

or

 url(r'^', include('LnkdIn.urls')), 
+7
source

Source: https://habr.com/ru/post/1267341/


All Articles