Shell saying that django_cleanup module I've installed don't exist

时间:2019-03-17 22:49:35

标签: python django

Like in title I've installed django_cleanup by using:

pip install django-cleanup

and put in INSTALLED_APPS:

INSTALLED_APPS = [
'django_cleanup',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.sites',
'django.contrib.flatpages',
'shop',
'account',
'rest_framework',
]

but now when I'm trying to run test or server in shell then i get:

ModuleNotFoundError: No module named 'django_cleanup'

1 个答案:

答案 0 :(得分:0)

https://github.com/un1t/django-cleanup#configuration

The directions in the configuration section state this is the correct method to add to INSTALLED_APPS:

INSTALLED_APPS = [
    ...
   'django_cleanup.apps.CleanupConfig',
]

And I would add it at the end of the installed apps list, not at the head