I am using Django for a project but getting following error.
It was running perfectly before.
I guess, path is not matching in my import. Can I get some hint regarding the path?
My urls.py
looks like this:
from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name='index'),
path('settings', views.settings, name='settings'),
path('upload', views.upload, name='upload'),
path('follow', views.follow, name='follow'),
path('search', views.search, name='search'),
path('profile/<str:pk>', views.profile, name='profile'),
path('like-post', views.like_post, name='like-post'),
path('signup', views.signup, name='signup'),
path('signin', views.signin, name='signin'),
path('logout', views.logout, name='logout'),
Can I get some hint to get rid of this error? Thank you
CodePudding user response:
You should add slashes to the urls in urls.py because it is necessary according to the django official documentation.
from django.urls import path
from . import views
urlpatterns = [
path('', views.index, name='index'),
path('settings/', views.settings, name='settings'),
path('upload/', views.upload, name='upload'),
path('follow/', views.follow, name='follow'),
path('search/', views.search, name='search'),
path('profile/<str:pk>/', views.profile, name='profile'),
path('like-post/', views.like_post, name='like-post'),
path('signup/', views.signup, name='signup'),
path('signin/', views.signin, name='signin'),
path('logout/', views.logout, name='logout'),
CodePudding user response:
I think just add "/" after signup in urls like this
path('signup/', views.signup, name='signup'),