Open trankov opened 3 months ago
This is a Django behavior, not Django Ninja one. When multiple URL patterns match the request URL, it will always use the first one. So the correct way of defining this catch-all view is to put it at the bottom of the module, as you mentioned.
Django runs through each URL pattern, in order, and stops at the first one that matches the requested URL, matching against
path_info
.
If some
@router...
decorator has path parameter like a'/{variable}'
, then all the following routes in the same module became to call not their decorated functions, but this one.After changing the pattern, f.e.
'/{variable}/'
or'/more/{variable}'
, the proper behaviour returns. Putting this route function to the bottom of a module leads to normal behavior.An error raises at
ninja/operation.py:120
as follows:Versions