How to handle multiple URL patterns. Any pattern order leads to 404 for different pages

37 views Asked by At

I need your help. There was a problem with the url, the structure is as follows:

  • the main project file urls.py
urlpatterns = [
    path('admin/', admin.site.urls),
    path('ckeditor/', include('ckeditor_uploader.urls')),
    path('', include('shop.urls')),
    path('', include('informations.urls')),
]
  • shop.urls
urlpatterns = [
    path('', views.index, name="index"),
    path('contact', views.Contact, name="contact"),
    path('<str:category_slug>/', views.TireListByCategory, name='category_list'),
    path('pdf/<int:id>/', views.render_pdf_detail_view, name='test-pdf-view'),
    path('pdf/category/<str:category_slug>/', views.render_pdf_category_view, name='category_pdf_list'),
    path('brand/<str:slug>/', views.BrandDetail, name='brand_detail'),
    path('<str:category_slug>/<str:slug>/', views.TireDetail, name='tire_detail'),
    path('brands/<str:brand_slug>/<str:slug>/', views.BrandModelDetail, name='brand_model_detail'), 
]
  • informations.urls
urlpatterns = [
    path('blog/', views.page_info_blog, name='page_info_blog'),
    path('<str:category_info_slug>/', views.category_info_detail, name='category_info_detail'),
    path('<str:category_info_slug>/<str:page_info_slug>/', views.page_info_detail, name='page_info_detail')
]

The first include('shop.urls') works fine The second is a 404 error Also, when replacing places, only the first one on the list works, the second one is a 404 error

Please tell me about the level urls. M

I change places, then only the first one on the list works. The second throws a 404 error

enter image description here

0

There are 0 answers