AttributeError:module ...没有属性'CustomRegisterSerializer'

时间:2017-12-11 11:19:21

标签: python django django-rest-framework django-rest-auth

我正在尝试使用django-rest-auth的自定义寄存器序列化程序。

用户应用的名称为myapp.users,序列化程序文件位于该应用中。

在序列化程序文件中我有:

class CustomRegisterSerializer(RegisterSerializer):

settings.py

REST_AUTH_REGISTER_SERIALIZERS = {  
    "REGISTER_SERIALIZER": 'myapp.users.serializers.CustomRegisterSerializer'
}

但是这个错误不断发生:

AttributeError: module 'myapp.users.serializers.CustomRegisterSerializer' has no attribute 'CustomRegisterSerializer'

编辑1:

在设置中安装了应用

THIRD_PARTY_APPS = [
    'crispy_forms',  # Form layouts
    'allauth',  # registration
    'allauth.account',  # registration
    'allauth.socialaccount',  # registration
    'rest_framework', #api
    'rest_auth.registration',
    'rest_framework.authtoken',
    'rest_auth',
    'corsheaders',
     'rest_framework_tracking',
]
LOCAL_APPS = [
    # custom users app
    'myapp.users.apps.UsersConfig',

]
INSTALLED_APPS = DJANGO_APPS + THIRD_PARTY_APPS + LOCAL_APPS

编辑2:     来自django.apps导入AppConfig

class UsersConfig(AppConfig):
    name = 'myapp.users'
    verbose_name = "Users"

你认为我错过了什么?

0 个答案:

没有答案
相关问题