urls.py
urlpatterns = [
re_path(r'^([-\w]{3,})/$', shop_from_url, name='shop_from_url'),
path('ckeditor/', include('ckeditor_uploader.urls')),
path('', include('products.urls')),
path('authenticate/', include('authenticate.urls')),
path('order/', include('order.urls')),
path('offers/', include('offers.urls')),
path('event/', include('event.urls')),
path('product_upload/', include('product_upload.urls')),
path('restaurant/', include('restaurant.urls')),
path('shop/', include('store.urls')),
]
i have these url pattern. If you watch it, the first and other url path, they are exactly same in the way they are written. the difference is only that first url is parameterised url and other are hardcoded urls.
But actually when i call any of the url the first urls also called.
I have to check if there is any existing url (like authenticate/
, product_upload/
) matching to any of the app url then it should redirect to that otherwise it should call re_path(r'^([-\w]{3,})/$')
(first url) this url
Is there any way to call the first url (which lies in this pattern) only when the url does not matches the other urls.
Note: I cannot change the urls as it is a requirement.