[Answered ]-Django url from a django app is giving 404 error

1👍

You don’t use a regex for path(…) [Django-doc], for regexes, you use re_path(…) [Django-doc]. But here it is not necessary: you can define this with path(…):

from django.contrib import admin
from django.urls import path, include
from . import views

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', views.home, name='home'),
    path('about', views.about, name='about'),
    path('contact', views.contact, name='contact'),
    path('user/', include('user.urls')),
]

and for user/urls.py:

urlpatterns = [
    path('login/', views.login, name='login'),
]

Leave a comment