54👍
Check that you have properly named the name
kwarg in your urls
file.
It’s a keyword argument, not an argument. So you should type the keyword and the value.
For example your current urlpatterns
list in one of your installed apps urls.py
file looks like this:
urlpatterns = [
path('', views.index, 'index'),
path('like/', views.like, 'like')
]
You should check if you have missed the name
kwarg. The above code should be changed to:
urlpatterns = [
path('', views.index, name='index'),
path('like/', views.like, name='like')
]
If you want to find it faster, you can comment each app’s url inclusion, in the your_project/urls.py
file. When the error is gone, it means that you should check the commented app urls.py
file.
24👍
Check if you have the name
argument in all of your urls.py
files, for each Django app you have installed.
If you have specified a name argument for any url in the path
function, it should be declared like path('', views.a, name='view.a')
, not like path('', views.a, 'view.a')
.
Notice the absence of the name
argument in the latter code.
If you miss the name argument, you will get the 'TypeError at / 'str' object is not a mapping'
error.
- [Django]-Has Django served an excess of 100k daily visits?
- [Django]-Django.core.exceptions.ImproperlyConfigured: Requested setting LOGGING_CONFIG, but settings are not configured
- [Django]-ValueError: Missing staticfiles manifest entry for 'favicon.ico'
20👍
Please, check for errors in admin_llda.urls
.
You might have missed adding name=''
in one of the path()
calls.
E.g.:
You might have written
path('',views.some_method, 'somename')
instead of path
path('',views.some_method, name= 'somename')
- [Django]-Disadvantages of using ASGI instead of WSGI
- [Django]-Django most efficient way to count same field values in a query
- [Django]-How to add custom search box in Django-admin?
2👍
I just had the same issue and I found the solution! Check your urls.py and whether you failed to name any url appropriately- not necessarily
- [Django]-How to launch tests for django reusable app?
- [Django]-Advantages to using URLField over TextField?
- [Django]-How to redirect with messages to display them in Django Templates?
- [Django]-Django fuzzy string translation not showing up
- [Django]-How to override the verbose name of a superclass model field in django
- [Django]-What does it mean to normalize an email address?
0👍
Try adding namespace to your url
e.g add the following to your ‘my_app/urls.py’
app_name='my_app'
then your template should look something like: <a class="item" href="{% url 'my_app:home' %}">
finally be sure to register your app in the ‘my_project/settings.py’
https://docs.djangoproject.com/en/3.0/topics/http/urls/#naming-url-patterns
- [Django]-Adding inline many to many objects in Django admin
- [Django]-How does one make logging color in Django/Google App Engine?
- [Django]-Migrating data from "Many-To-Many" to "Many-To-Many Through" in django