[Answered ]-ImproperlyConfigured: Error importing middleware django.contrib.admindocs.middleware: "No module named middleware"

2👍

This is a spot where you need to pay close attention to the version of the documentation you’re reading.

If you’re on Django 1.5 or lower, use:

'django.middleware.doc.XViewMiddleware',

If you’re on Django 1.6 or greater, use:

'django.contrib.admindocs.middleware.XViewMiddleware',

0👍

I ran into the same problem a few days ago…

  • add 'django.contrib.admindocs,' to your INSTALLED_APPS
  • add 'django.contrib.admindocs.middleware.XViewMiddleware', to your MIDDLEWARE_CLASSES
👤OBu

0👍

I’m on Django 1.6. This is the line that worked for me in MIDDLEWARE_CLASSES:

django.middleware.doc.XViewMiddleware

The other suggestion for Django 1.6 didn’t work for me.

Leave a comment