Django使用drf 视图集开发接口进行测试时,报错如下:
。。。。。。
File "F:\python\python-drf\venv-task\lib\site-packages\rest_framework\routers.py", line 162, in get_routes
raise ImproperlyConfigured(msg % ', '.join(not_allowed))
django.core.exceptions.ImproperlyConfigured: Cannot use the @action decorator on the following methods, as they are existing routes: destroy
说明路由在进行自动拼接时,destroy这个方法的路由已经存在,打开自己的视图函数,发现自己定义的destroy方法使用action装饰器定义了请求路由,删掉即可。
把红框的内容删掉即可。