Skip to content

django-configurations settings importer wasn't correctly installed #9661

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Niedzwiedzw opened this issue Oct 29, 2020 · 1 comment
Closed
Labels
bug mypy got something wrong

Comments

@Niedzwiedzw
Copy link

Niedzwiedzw commented Oct 29, 2020

Bug Report

when trying to run "mypy" on my company's existing codebase I'm getting an error as follows:

root@826a40544ab8:/app/wwau/wwau# mypy --config-file=./setup.cfg ./wwau/settings.py 
Error constructing plugin instance of NewSemanalDjangoPlugin

Traceback (most recent call last):
  File "/usr/local/bin/mypy", line 8, in <module>
    sys.exit(console_entry())
  File "/usr/local/lib/python3.6/site-packages/mypy/__main__.py", line 8, in console_entry
    main(None, sys.stdout, sys.stderr)
  File "mypy/main.py", line 90, in main
  File "mypy/build.py", line 180, in build
  File "mypy/build.py", line 229, in _build
  File "mypy/build.py", line 472, in load_plugins
  File "mypy/build.py", line 450, in load_plugins_from_config
  File "/usr/local/lib/python3.6/site-packages/mypy_django_plugin/main.py", line 100, in __init__
    self.django_context = DjangoContext(django_settings_module)
  File "/usr/local/lib/python3.6/site-packages/mypy_django_plugin/django/context.py", line 88, in __init__
    apps, settings = initialize_django(self.django_settings_module)
  File "/usr/local/lib/python3.6/site-packages/mypy_django_plugin/django/context.py", line 70, in initialize_django
    settings._setup()
  File "/usr/local/lib/python3.6/site-packages/django/conf/__init__.py", line 66, in _setup
    self._wrapped = Settings(settings_module)
  File "/usr/local/lib/python3.6/site-packages/django/conf/__init__.py", line 157, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
  File "/usr/local/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/app/wwau/wwau/wwau/settings.py", line 5, in <module>
    from common_settings import CommonBase, CommonLocal, CommonCI, CommonServer, VerboseLoggingMixin
  File "/app/shared/common_settings.py", line 17, in <module>
    class CommonBase(Configuration):
  File "/usr/local/lib/python3.6/site-packages/configurations/base.py", line 28, in __new__
    raise ImproperlyConfigured(install_failure)
django.core.exceptions.ImproperlyConfigured: django-configurations settings importer wasn't correctly installed. Please use one of the starter functions to install it as mentioned in the docs: https://django-configurations.readthedocs.io/

To Reproduce

Unable to reproduce in a similar django project sadly.

Expected Behavior

Just like in the other project - I'd like to see the mypy type errors in the console.

Actual Behavior

as above

Your Environment

  • Mypy version used: mypy 0.790
  • Mypy command-line flags: none
  • Mypy configuration options from mypy.ini (and other config files):
    [mypy]
    files=wwau,../../shared
    ignore_missing_imports=true
    plugins =
    mypy_django_plugin.main

[mypy.plugins.django-stubs]
django_settings_module = "wwau.settings"

@Niedzwiedzw Niedzwiedzw added the bug mypy got something wrong label Oct 29, 2020
@JelleZijlstra
Copy link
Member

This looks like an issue with the mypy plugin for Django, which is not part of mypy itself. Could you report the issue to the project that provides that plugin? It could also be an issue with your Django code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong
Projects
None yet
Development

No branches or pull requests

2 participants