1. from django.urls import include, path, re_path
    
  2. 
    
  3. from . import views
    
  4. 
    
  5. ns_patterns = [
    
  6.     # Test urls for testing reverse lookups
    
  7.     path("", views.index, name="index"),
    
  8.     re_path(r"^client/([0-9,]+)/$", views.client, name="client"),
    
  9.     re_path(
    
  10.         r"^client/(?P<id>[0-9]+)/(?P<action>[^/]+)/$",
    
  11.         views.client_action,
    
  12.         name="client_action",
    
  13.     ),
    
  14.     re_path(
    
  15.         r"^client/(?P<client_id>[0-9]+)/(?P<action>[^/]+)/$",
    
  16.         views.client_action,
    
  17.         name="client_action",
    
  18.     ),
    
  19.     re_path(r"^named-client/([0-9]+)/$", views.client2, name="named.client"),
    
  20. ]
    
  21. 
    
  22. 
    
  23. urlpatterns = ns_patterns + [
    
  24.     # Unicode strings are permitted everywhere.
    
  25.     re_path(r"^Юникод/(\w+)/$", views.client2, name="метка_оператора"),
    
  26.     re_path(r"^Юникод/(?P<tag>\S+)/$", views.client2, name="метка_оператора_2"),
    
  27.     # Test urls for namespaces and current_app
    
  28.     path("ns1/", include((ns_patterns, "app"), "ns1")),
    
  29.     path("ns2/", include((ns_patterns, "app"))),
    
  30. ]