When creating a path inside a urls.py file, one often does this:
urlpatterns = [
path(\'foo/\',views.FooView,name=\'bar\'),
]
I\'m a be
The above answers did not cater to me as a beginner. Maybe I could explain it in more layman terms.
After adding a url path in the urls file, and defining corresponding view function to deal with it, If we want to access this same url through views in some place else, or maybe in the template file of your html pages, you do that using name and namespace in your code to access it, just like variable names. This helps because defining another url path and/or using direct links, makes the code more difficult to maintain.
For Example:
x=5
xi=x+1
xd=x-1
xf=x
is better than the one below, since if you want to change x to something else someday, it is just one change away.
x=5
xi=6
xd=4
xf=5
As for how to use it, you could use the above answers or read django URL naming.