Some question about nested url namespaces

Hi! I’ve read a post about nested urls, and I have another similar question: what’s the best practice for nested url namespaces? And why name the argument app_namespace while it also accept a non-app namespace?:thinking:BTW I’m using this code to namespace nested urls:

# you can access url "service/exam/student/" to call the views.service_exam_student()
# also reverse("service:exam:student") returns "service/exam/student/"

# exam.py
student_patterns = [
    path("student/", views.service_exam_student, "student"),
]

# urls.py
service_patterns = [
    path("exam/", include((exam_patterns, "exam"))),
]
urlpatterns = [
    # ...
    path("service/", include((service_patterns, "service"))),
    # ...
]

I means, why not let them have a common style like:

# exam.py
student_patterns = [
    path("student/", views.student, "student"),
]

# urls.py
service_patterns = [
    path("exam/", include(exam_patterns), "exam"),
]
urlpatterns = [
    # ...
    path("service/", include(service_patterns), "service"),
    # ...
]

I’m not following what you’re asking here.

But the difference in the two cases is that in the first case, the quoted values “exam” and “service” contained within the include statement become part of the url’s named namespace, while in the second version it doesn’t.

See the docs at:

Please excuse the late reply😭 Thank you very very much for your helpful reply. I’ve read the documents you listed, and I have also searched on the Internet, which taught me a lot. I realized this question is not good. Sorry😥 I will read more before asking.