1、忘记这两行代码
queryset = Book.objects.all()
serializer_class = Book_ModelSerializer

AssertionError: 'Publish_GAPIView' should either include a `queryset` attribute, or override the `get_queryset()` method.

 

2、要返回Response对象

AssertionError: Expected a `Response`, `HttpResponse` or `HttpStreamingResponse` to be returned from the view, but received a `<class 'NoneType'>`

 

 

3、配置文件应用里没注册标签'admin'

LookupError:No installed app with label 'admin'

 

 

 4、视图类的方法写错了。

Method Not Allowed:  /uuser/

 

 5、外键字段错误。

django.core.exceptions.FieldError: Cannot resolve keyword 'user' into field. Choices are: fk_user, fk_user_id, id, token

 

 6、postman的请求方式错了

rest_framework.request.WrappedAttributeError: 'NoneType' object has no attribute 'fk_user'

 

7、响应Response类有序列化功能,对象不能序列化。

TypeError: Object of type 'User' is not JSON serializable

 

8、base64解码时报错,base64的长度是固定的,不够用=补。

return binascii.a2b_base64(s)

 

posted on 2021-07-13 17:47  孟玉  阅读(501)  评论(0编辑  收藏  举报