TypeError: ‘class Meta’ got invalid attribute(s): constraints constraints是在django2.2版本之后才有得,所以,你应该从Meta中删除它,或者升级django版本==2.2.