Write Urls
In Django, URLs are used to map a request to a specific view function that should handle the request and return a response. URLs in Django are defined in the urls.py file of each app.
Add following code in your blog/urls.py
blog/urls.py
path("home/", views.home, name="home"),
path("signup/", views.signup, name="signup"),
path("signin/", views.signin, name="signin"),
path("posts/", views.get_all_posts, name="posts"),
path("post/<int:id>", views.get_post_by_id, name="post"),
path("post/<int:id>/comments/", views.comment, name="comments"),
note
Function names should comply with a naming convention (python:S1542)
Name functions with the default provided regular expression: ^[a-z_][a-z0-9_]*$
e.g. def my_function(a,b)
Your blog/urls.py should look like this:
blog/urls.py
from django.urls import path
from . import views
urlpatterns = [
path("home/", views.home, name="home"),
path("signup/", views.signup, name="signup"),
path("signin/", views.signin, name="signin"),
path("posts/", views.get_all_posts, name="posts"),
path("post/<int:id>", views.get_post_by_id, name="post"),
path("post/<int:id>/comments/", views.comment, name="comments"),
]
tip
<int:id> means there will be an id in path parameters of type integer.