Method Not Allowed (POST) in simplest class-based view, django 4.2

Hi all,

there should be really simple solution to my problem, but somehow I am not able to find it using just Google.

I have a bare bone project (just started to build it for education purposes), in it I have just one app (named ‘monolith’). I am using Django 4.2.4. file(s) are super simple:

# project
urlpatterns = [
    # path('admin/',,
    path("monolith/", include("monolith.urls")),
# monolith
urlpatterns = [
    path("asset/", AssetList.as_view()),

Model is:

class Asset(m.Model):
    name = m.CharField(max_length=255, unique=True)
    version = m.CharField(max_length=50, null=False)
    description = m.TextField(null=True, blank=True)
    created_at = m.DateTimeField(auto_now_add=True, null=False)

    class Meta:
        db_table = 'esi_asset'
        unique_together = (('name', 'version'))

    def __str__(self):

View is:

class AssetList(View):
    def get(self, request, *args, **kwargs):
        r_data = []
        for asset in Asset.objects.all():
             # some project logic
        return JsonResponse({
            'status': HTTPStatus.OK,
            'data': r_data

    def put(self, request, *args, **kwargs):
        # some project logic
        return JsonResponse({
            'status': HTTPStatus.OK,
            'data': r_data
        }) are only changed to include this stuff:


other that that, are auto generated.

After building this much, I wanted to test my super-super new app, only to discover that GET works fine from any client, but POST requests are rejected.

I am using built-in server:

python runserver

GET request correctly returns: {"status": 200, "data": []}
POST just gives me:

Method Not Allowed (POST): /monolith/asset/
Method Not Allowed: /monolith/asset/
[11/Aug/2023 15:03:49] "POST /monolith/asset/ HTTP/1.1" 405 0

I get the same behavior using Browser, Postman or by using a simple ‘curl’ command (preferred choice for me if possible to use it).

What I am looking for is really any solution that would allow me to make POST requests. This is a local development machine, so disabling all security features is perfectly fine for me. I just don’t know how to do it.

Anyway, thanks for reading this, and double thanks if you have any idea how to resolve this,

Most threads here recommend to set CSRF_TRUSTED_ORIGINS, but doing this made no difference:

The issue is that you’ve defined a handler for put but not for post.

Arrhg, I knew it had to be something trivial!!

I don’t even understand how I mistyped the method name. I must be more tired that I realize.

Thanks a million, Ken.
Best regards,