Skip to content

ImproperlyConfigured exception about LOGGING_CONFIG #309

Open
@sylvain1811

Description

@sylvain1811

I'm getting the following error when I run pylint on my project using pylint-django==2.4.2:

> poetry run pylint --django-settings-module=myapp.settings myapp
Traceback (most recent call last):
  File "/home/sylvain/LNS/mylns-api/.venv/lib/python3.7/site-packages/pylint_django/checkers/foreign_key_strings.py", line 90, in open
    django.setup()
  File "/home/sylvain/LNS/mylns-api/.venv/lib/python3.7/site-packages/django/__init__.py", line 19, in setup
    configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
  File "/home/sylvain/LNS/mylns-api/.venv/lib/python3.7/site-packages/django/conf/__init__.py", line 82, in __getattr__
    self._setup(name)
  File "/home/sylvain/LNS/mylns-api/.venv/lib/python3.7/site-packages/django/conf/__init__.py", line 67, in _setup
    % (desc, ENVIRONMENT_VARIABLE))
django.core.exceptions.ImproperlyConfigured: Requested setting LOGGING_CONFIG, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.

I have a .pylintrc file loading pylint-django, and I think I correctly use --django-settings-module=myapp.settings command line argument. I also tried to add django-settings-module=myapp.settings in my .pylintrc, still failed.

I've read comments on #306, especially this one and I think it's an issue of pylint-django itself and not about configuration, so I create this issue.

Workaround: downgrade to 2.3.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions