why swagger raises unclear error - Django

后端 未结 1 1324
礼貌的吻别
礼貌的吻别 2021-02-02 13:16

I have a django rest Backend app, and i use swagger to look and document my apis to the FE.

This worked fine, but I made some changes and now I get this error:

1条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-02 13:38

    I ran into the same issue, the fix is described here: https://www.django-rest-framework.org/community/3.10-announcement/

    To summarize, Django Rest Framework 3.10 (released a few days ago) deprecated the CoreAPI based schema generation, and introduced the OpenAPI schema generation in its place. Currently to continue to use django-rest-swagger as is you need to re-enable the CoreAPI schema generation by adding the following config to the settings file:

    REST_FRAMEWORK = { ... 'DEFAULT_SCHEMA_CLASS': 'rest_framework.schemas.coreapi.AutoSchema' }
    

    0 讨论(0)
提交回复
热议问题