4đź‘Ť
The error pretty much describes your problem. You’re missing a call to patterns()
in your first definition of urlpatterns
.
2đź‘Ť
TypeError at / can only concatenate tuple (not “list”) to tuple
It means exactly what it says. It is complaining about urlpatterns += patterns(...)
. The +=
attempts to concatenate (chain together) two things. urlpatterns
is a tuple. The value returned by patterns(...)
is a list. You can’t mix these for concatenation.
To fix this, you must first decide whether you want a tuple or a list as the result (concatenating two tuples gives a tuple, and concatenating two lists gives a list), and then fix one side or the other accordingly.
In your case, you apparently want a list. The value you assign to urlpatterns
first looks like a set of arguments for patterns()
. The simple explanation, as @patrys points out, is that you meant (and forgot) to call the function here. That would give you a list, to which you could then append (concatenate) the list from the second call.
Note that you can also do it all in one go: urlpatterns = patterns(...) + patterns(...)
.
Where is the list in there?
The result of the patterns()
calls, as explained above (and also by the documentation, presumably – I don’t know anything about django, I’m just good at debugging.)
- [Django]-DRF PrimaryRelatedField when write and NestedSerializer when read?
- [Django]-What does 'serializer.initial_data' mean?
- [Django]-Django – admin_order_field with custom non-related object
- [Django]-Django-Debug-Toolbar not showing(disallowed MIME type)
- [Django]-Django South vs Migratory