object() takes no parameters in django 1.10

前端 未结 2 1892
再見小時候
再見小時候 2020-12-20 16:23

I\'m trying to allow CORS in my app, so that my cross-domain javascript client can access my API, I\'ve installed django-cors-headers. And I\'m now trying to add the middlew

相关标签:
2条回答
  • 2020-12-20 16:50

    If you have custom middleware and you've moved from MIDDLEWARE_CLASSES to MIDDLEWARE, then you need to update your middleware. Details on: this Django documentation page. TL;DR, subclass from MiddlewareMixin instead of object:

    from django.utils.deprecation import MiddlewareMixin
    class FOOMiddleware(MiddlewareMixin):
        pass
    
    0 讨论(0)
  • 2020-12-20 17:00

    This issue says that django-cors-headers is no longer supported, and suggests using django-cors-middleware instead.

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