Skip to content
Advertisement

ModuleNotFoundError: No module named ‘admin’

I have this new remote job, where I had to clone all the code from a repository, and I have to make an export of the database from MySQL hosted in RDS.

The first problem is that when I set up the configuration to start the app, it raise an error telling me this:

Run Configuration Error: Broken configuration due to unavailable plugin or invalid configuration data.

The other thing is that I already have the data dumped and set up in my local storage (the app works this way, is no longer using AWS Cloud) but when I try to do an python manage.py migrate , this error comes up…

Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "C:UsersTony-AppDocumentsAppvenvlibsite-packagesdjangocoremanagement__init__.py", line 338, in execute_from_command_line
    utility.execute()
  File "C:UsersTony-AppDocumentsAppvenvlibsite-packagesdjangocoremanagement__init__.py", line 312, in execute
    django.setup()
  File "C:UsersTony-AppDocumentsAppvenvlibsite-packagesdjango__init__.py", line 18, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "C:UsersTony-AppDocumentsAppvenvlibsite-packagesdjangoappsregistry.py", line 85, in populate
    app_config = AppConfig.create(entry)
  File "C:UsersTony-AppDocumentsAppvenvlibsite-packagesdjangoappsconfig.py", line 86, in create
    module = import_module(entry)
  File "C:UsersTony-AppAppDataLocalProgramsPythonPython37-32libimportlib__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "C:UsersTony-AppDocumentsAppvenvlibsite-packagesliststyle__init__.py", line 1, in <module>
    from admin import ListStyleAdminMixin
ModuleNotFoundError: No module named 'admin'

Advertisement

Answer

First, django-liststyle is a dependency in your project, so make sure it has been installed.

py -m pip install django-liststyle

Second, make sure to add that package to INSTALLED_APPS:

INSTALLED_APPS = {
    ...
    'liststyle',
    ...
    'django.contrib.admin',
    ...
}

Third, I think the error you are getting is because of the way you are importing ListStyleAdminMixin. This should be the correct way to import it:

from liststyle.admin import ListStyleAdminMixin
Advertisement