pythondjangopython-2.7django-1.8

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:\Users\Tony-App\Documents\App\venv\lib\site-packages\django\core\management\__init__.py", line 338, in execute_from_command_line
    utility.execute()
  File "C:\Users\Tony-App\Documents\App\venv\lib\site-packages\django\core\management\__init__.py", line 312, in execute
    django.setup()
  File "C:\Users\Tony-App\Documents\App\venv\lib\site-packages\django\__init__.py", line 18, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "C:\Users\Tony-App\Documents\App\venv\lib\site-packages\django\apps\registry.py", line 85, in populate
    app_config = AppConfig.create(entry)
  File "C:\Users\Tony-App\Documents\App\venv\lib\site-packages\django\apps\config.py", line 86, in create
    module = import_module(entry)
  File "C:\Users\Tony-App\AppData\Local\Programs\Python\Python37-32\lib\importlib\__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:\Users\Tony-App\Documents\App\venv\lib\site-packages\liststyle\__init__.py", line 1, in <module>
    from admin import ListStyleAdminMixin
ModuleNotFoundError: No module named 'admin'

Solution

  • 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