I have created a new template in my app menus.html The index path is working fine but when I added a new template that path is not working. Below is my url code in app
urlpatterns = [
path('', views.index, name='index'),
# url(r'^resto/menus/$', views.menus, name='menus')
path('menu/', views.menus, name='menus'),
]
The path specified in first line is working fine. I want to add a new view to the path (views.menus)
Below is my urls.py from main app
urlpatterns = [
path('admin/', admin.site.urls),
path('resto/', include('resto.urls'))
]
My menus.html file
def menus(request):
return HttpResponse("Test")
I tried restarting the server but not worked,
I am accessing this url http://localhost:8000/menus/
Your app (resto
app) urls are wired to /resto/
path and thus any path on your app will be prefixed with /resto/
.
So, you need to call /resto/menu/
to access the views.menus
view.