diff --git a/cmsmanage/mypy_django_configurations_plugin.py b/cmsmanage/mypy_django_configurations_plugin.py new file mode 100644 index 0000000..b52779c --- /dev/null +++ b/cmsmanage/mypy_django_configurations_plugin.py @@ -0,0 +1,12 @@ +# https://github.com/typeddjango/django-stubs/pull/180#issuecomment-820062352 +import os + +from configurations import importer +from mypy_django_plugin import main + + +def plugin(version): + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "cmsmanage.settings") + os.environ.setdefault("DJANGO_CONFIGURATION", "Dev") + importer.install() + return main.plugin(version) diff --git a/pyproject.toml b/pyproject.toml index fd4dabe..e321e93 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -90,13 +90,14 @@ indent_size = 2 [tool.mypy] plugins = [ + "./cmsmanage/mypy_django_configurations_plugin.py", "mypy_django_plugin.main", "mypy_drf_plugin.main", ] [tool.django-stubs] -django_settings_module = "cmsmanage.settings.dev" - +django_settings_module = "cmsmanage.settings" +strict_settings = false [[tool.pdm.source]] url = "https://pypi.org/simple"