Issue
This is my main urls.py:
urlpatterns = [
path('admin/', admin.site.urls),
path('', include("shop.urls")),
]
I want that any url entered by user will redirect to shop.urls and find there like if the user enters /index it will search index in shop.urls not in main urls.
My shop.urls:
from django.urls import path
from . import views
urlpatterns = [
path('', views.index),
path('index', views.index),
]
Solution
You need to add /
at the end of route so:
urlpatterns = [
path('', views.index),
path('index/', views.index),
]
Then enter the requested url as http://127.0.0.1:8000/index/
Answered By - Sunderam Dubey
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.