【问题标题】:I can't see DRF api confirm browser我看不到 DRF api 确认浏览器
【发布时间】:2021-05-21 12:25:55
【问题描述】:

我想见

但我的浏览器是

我通过邮递员检查了api操作。

我不知道是什么问题..

我认为代码没有问题

这是我的代码 项目文件夹 urls.py

url(r'^', include('django.contrib.auth.urls')),
url(r'^rest-auth/', include('rest_auth.urls')),
url(r'^rest-auth/registration/', include('rest_auth.registration.urls')),
url(r'^account/', include('allauth.urls')),
url(r'^accounts-rest/registration/account-confirm-email/(?P<key>.+)/$',
    confirm_email, name='account_confirm_email'),

settings.py

REST_FRAMEWORK = {
    'DEFAULT_PERMISSION_CLASSES': (
        # 'rest_framework.permissions.IsAuthenticated',
        'rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly',
    ),
    'DEFAULT_AUTHENTICATION_CLASSES': [
        'rest_framework_jwt.authentication.JSONWebTokenAuthentication',
    ],
    'DEFAULT_RENDERER_CLASSES': [
        'rest_framework.renderers.JSONRenderer',
    ],
}
REST_AUTH_SERIALIZERS = {
    'USER_DETAILS_SERIALIZER': 'accounts.serializers.UserSerializer',
}

任何提示将非常非常非常感谢:)

【问题讨论】:

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


    【解决方案1】:

    rest_framework.renderers.BrowsableAPIRenderer 添加到REST_FRAMEWORK 设置的默认渲染器类中。

    ...
    'DEFAULT_RENDERER_CLASSES': [
            'rest_framework.renderers.JSONRenderer',
            'rest_framework.renderers.BrowsableAPIRenderer',
      ]
    ... 
    

    【讨论】:

    • 不用担心。乐于助人?
    猜你喜欢
    • 2013-09-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-08-01
    • 1970-01-01
    • 2019-10-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多