Answer the question
In order to leave comments, you need to log in
Is it correct to specify addresses like this in the root urls.py?
Suppose the request goes to the address localhost:8000/main/
I understand correctly that in any case, Django will go to the first application, look for it main/
, but not find it.
Then he will go to the second and find it there.
Is it correct to write like this? Is such a code practiced?
urlpatterns = [
path('admin/', admin.site.urls),
path('', include('one.urls')),
path('', include('two.urls')),
]
Answer the question
In order to leave comments, you need to log in
Yes, you understand correctly. I think that this is not particularly correct, but I wrote this way and it has been working on one of the sites for more than a year, there are no problems.
I just left a comment, just in case
# Эти 2 роута всегда внизу! posts последний!
path('', include('front.urls')),
path('', include('posts.urls')),
domain.ru/my_link
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question