Django: Error: Incorrectly configured module does not define class ""

Incorrect Configured: the report middleware module does not define the ReportMiddleware class

But I defined this, but probably determined in the wrong place, so where should I put this class file?

+3
source share
2 answers

You must put it in the module in the package, as indicated in the configuration MIDDLEWARE_CLASSES.

+1
source

Today I had the same error. This was due to a confusing (at least for me) naming scheme.

If you specify your middleware as follows:

'yourapp.SomeMiddleware'

settings.py SomeMiddleware SomeMiddleware.py , . settings.py :

'yourapp.SomeMiddleware.SomeMiddleware'

yourapp/middleware.py django.contrib middlewares, seetings.py :

'yourapp.middleware.SomeMiddleware'
+14

Source: https://habr.com/ru/post/1772039/


All Articles