Python Django中无法解释的错误

Python Django中无法解释的错误,python,django,Python,Django,当我尝试运行$“python manage.py runserver localhost:8000”时,我得到下面的异常错误 请帮忙!!!我做错了什么 Request Method: GET Django Version: 1.8.13 Exception Type: TypeError Exception Value: __init__() takes 1 positional argument but 2 were given Exception Location: /usr/loc

当我尝试运行$“python manage.py runserver localhost:8000”时,我得到下面的异常错误

请帮忙!!!我做错了什么

Request Method: GET Django Version: 1.8.13 Exception Type: TypeError Exception Value: __init__() takes 1 positional argument but 2 were given Exception Location: /usr/local/lib/python3.4/site-packages/django/core/handlers/base.py in get_response, line 132 Python Executable: /usr/local/bin/python3.4 Python Version: 3.4.4 forms.py

class Msg(forms.ModelForm):
    class Meta:
         model = Visitor
         fields = ['name', 'contact', 'message']
main/url.py

urlpatterns = [
    url(r'^contact/', include('msgapps.urls')),
]
msgapps/url.py

urlpatterns = patterns(
    'msgapps.views',
    url(r'^msg/$', CreateMsg, name='CreateMsg'),
)

为了在URL中使用CBV,您必须添加
。as_view()


为了在URL中使用CBV,您必须添加
。as_view()


谢谢毕达德。太好了,谢谢毕达德。杰出的
urlpatterns = patterns(
    'msgapps.views',
    url(r'^msg/$', CreateMsg, name='CreateMsg'),
)
urlpatterns = patterns(
    'msgapps.views',
    url(r'^msg/$', CreateMsg.as_view(), name='CreateMsg'),
)