Django python manage.py runserver returns 属性错误而不是启动虚拟服务器

Django python manage.py runserver returns attribute error instead of launching the virtual server

我多次查看这些行并在网站上搜索以找到类似的问题,但我无法弄清楚我错过了什么导致产生错误

urls.py - profiles_api

from django.urls import path
from profiles_api import views

urlpatterns = [
    path('hello-view/', views.HelloApiView.as_View()),
]

views.py - profiles_api

from rest_framework.views import APIView
from rest_framework.response import Response

class HelloApiView(APIView):
    """test API View"""

    def get(self, request, format=None):
        """Returns a list of APIView features"""
        an_apiview = [
            'Uses HTTP methods as function (get, post, patch, put, delete)',
            'Is similar to a traditional Django View',
            'Gives you the most control over your application logic',
            'Is mapped manually to URLs',
        ]

        return Response({'message': 'Hello!', 'an_apiview': an_apiview})

urls.py - profiles_project

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

urlpatterns = [
    path('admin/', admin.site.urls),
    path('api/', include('profiles_api.urls'))
]

异常:

(env) vagrant@ubuntu-bionic:/vagrant$ python manage.py runserver 0.0.0.0:8080

....

path('hello-view/', views.HelloApiView.as_View()),

AttributeError: type object 'HelloApiView' has no attribute 'as_View'

我猜是 typoas_view() 不是 as_View()

正如错误所说,没有属性 as_View。问题在于大写的 V。应该有as_view().