Skip to content
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

django.core.exceptions.ImproperlyConfigured: django-configurations settings importer wasn't correctly installed. #13

Open
Niedzwiedzw opened this issue Oct 29, 2020 · 0 comments

Comments

@Niedzwiedzw
Copy link

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"

  • Python version used: Python 3.6.10
  • Operating system and version:
    Linux 826a40544ab8 5.8.16-2-MANJARO Fix README #1 SMP PREEMPT Mon Oct 19 11:33:03 UTC 2020 x86_64 GNU/Linux
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant