Getting HTTP 405 Error

Hi
I am trying to leararn django by reading the book django for beginners by William.S.Vincent. in chapter 15 of this book after i added the comment feture to the article site when i try to reach the url 127.0.0.1:8000/articles and want to see all articles i get HTTP 405 error
actually i check my written code many times it is compleatly same as the book
i could not figure out what the problem is
any help would be apritiable

Can you provide details about the implementation? The views, urls related to this error?

Thank you for your quick response.actually i was somewhere for a couple of days and could not access to my computer.anyway here are view, urls and template of articles page :

here is the view

from django.contrib.auth.mixins import LoginRequiredMixin, UserPassesTestMixin
from django.views import View
from django.views.generic import ListView, DetailView, FormView
from django.views.generic.detail import SingleObjectMixin
from django.views.generic.edit import UpdateView, DeleteView, CreateView
from django.urls import reverse_lazy, reverse

from .forms import CommentForm
from .models import Article

class ArticleListView(LoginRequiredMixin, View):
model = Article
template_name = “article_list.html”

class CommentGet(DetailView):
model = Article
template_name = “article_detail.html”

def get_context_data(self, **kwargs):
    context = super().get_context_data(**kwargs)
    context["form"] = CommentForm()
    return context

class CommentPost(SingleObjectMixin, FormView) :
model = Article
form_class = CommentForm
template_name = “article_detail.html”

def post(self, request, *args, **kwargs):
    self.object = self.get_object()
    return super().post(request, *args, **kwargs)

def form_valid(self, form):
    comment = form.save(commit = False)
    comment.article = self.object
    comment.save()
    return super().form_valid(form)

def get_success_url(self):
    article = self.get_object()
    return reverse("article_detail", kwargs={"pk": article.pk})

class ArticleDetailView(LoginRequiredMixin, DetailView):
def get(self, request, *args, **kwargs):
view = CommentGet.as_view()
return view(request, *args, **kwargs)

def post(self, request, *args, **kwargs):
    view = CommentPost.as_view()
    return view(request, *args, **kwargs)

class ArticleUpdateView(UserPassesTestMixin, LoginRequiredMixin, UpdateView):
model = Article
fields = (“title”, “body”)
template_name = “article_edit.html”

def test_func(self):
    obj = self.get_object()
    return obj.author == self.request.user

class ArticleDeleteView(UserPassesTestMixin, LoginRequiredMixin, DeleteView):
model = Article
template_name = “article_delete.html”
success_url = reverse_lazy(“article_list”)

def test_func(self):
    obj = self.get_object()
    return obj.author == self.request.user

class ArticleCreateView(LoginRequiredMixin, CreateView):
model = Article
template_name = ‘article_new.html’
fields = (“title”, “body”)

def form_valid(self, form):
    form.instance.author = self.request.user
    return super().form_valid(form)

and the urls

and finally tmplate page(article_list.html)

Please do not post images of code, templates, html, error messages, etc.

Copy/paste the desired text into the body of your message, surrounded by lines of three backtick - ` characters. This means you’ll have a line of ```, then your code (or template, etc), then another line of ```.

You can edit your earlier reply showing your views to add those lines before and after that code.

Ok sorry actually i am a new user and not familiar with roles

No worries, we’re here to help.

and the urls

from django.urls import path
from .views import (
        ArticleListView,
        ArticleDetailView,
        ArticleDeleteView,
        ArticleUpdateView,
        ArticleCreateView
)
urlpatterns = [
        path("<int:pk>/", ArticleDetailView.as_view(), name = 'article_detail'),
        path("<int:pk>/edit/", ArticleUpdateView.as_view(), name = 'article_edit'),
        path("<int:pk>/delete/", ArticleDeleteView.as_view(), name = 'article_delete'),
        path("new/", ArticleCreateView.as_view(), name = 'article_new'),
        path("", ArticleListView.as_view(), name = 'article_list'),

and finally tmplate page(article_list.html)

{% extends "base.html" %}

{% block title %}Articles{% endblock title %}

{% block content %}
  {% for article in article_list %}
    <div class="card">
      <div class="card-header">
        <span class="font-weight-bold">{{article.title}}</span> &middot ;
        <span class="text-muted">by {{article.author}} | {{article.date}}</span>
      </div>
      <div class = "card-body">
        <p>{{article.body}}</p>
        <a href="{% url 'article_edit' article.pk %}">Edit</a> |
        <a href="{% url 'article_delete' article.pk %}">Delete</a>
      </div>
      <div class = "card-footer">
        {% for comment in article.comment_set.all %}
          <p>
            <span class = "font-weight-bold">{{comment.author}} &middot;
            </span>
            {{comment.body}}
          </p>
        {% endfor %}
      </div>
    </div>
    <br/>
  {% endfor %}
{% endblock content %}