#Python #Shorts
If we have more than one app inside our project and use the same name for two different paths between these apps, this is what's known as a URL name collision. Most likely you won't get an error but the output may not be what you wanted, since Django will just render the first match that it finds. To fix this problem, inside of your urls.py file define a new variable "app_name" and set it to the name of your app or some other unique identifier. Now inside of your HTML files, instead of doing "{%url 'some_path'%}" you can do "{%url 'yourappname:some_path'%}" and you'll avoid the collisions.
-------------------------------------------------------------------------------------
Links:
Blog: https://evgenyurubkov.com
Twitter: / evgenyurubkov
Instagram: / evgenyurubkov
Youtube: / @codevev
Смотрите видео Django URL Name Collision - Python Web Development! онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь codevev 07 Июль 2021, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 504 раз и оно понравилось 14 людям.