Reputation: 489
Hello I am new to django,
I have created a simple app for category wise product. for that I wanted to display as below url patterns.
to achieve this I have wrote a below code.
myapp/urls.py
file
import product
urlpatterns = [
url(r'^manage/', admin.site.urls),
url(r'^', include(product.urls)),
url(r'^product/', include(product.urls)),
]
in myapp/product/urls.py
(I am managing app wise urls)
from views import product_name, product_root
urlpatterns = [
url(r'^', product_root, name="ProductRoot"),
url(r'^product_name/', product_name, name="ProductName"),
]
Now when I runs the app and browse the page it gives me below result.
Can anyone guide me what I am doing wrong?
Upvotes: 0
Views: 33
Reputation: 599610
You need to terminate the patterns in your app urls:
url(r'^$', product_root, name="ProductRoot"),
url(r'^product_name/$', product_name, name="ProductName"),
Otherwise the first one will match everything.
Upvotes: 3