You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently our CI is failing due to mypy failing to find SECRET_KEY as used by SimpleJWT.
$ mypy . --check-untyped-defs
Traceback (most recent call last):
Error constructing plugin instance of NewSemanalDjangoPlugin
File "/home/runner/work/beep-backend/beep-backend/.venv/bin/mypy", line 8, in <module>
sys.exit(console_entry())
^^^^^^^^^^^^^^^
File "/home/runner/work/beep-backend/beep-backend/.venv/lib/python3.11/site-packages/mypy/__main__.py", line 15, in console_entry
main()
File "mypy/main.py", line 95, in main
File "mypy/main.py", line 174, in run_build
File "mypy/build.py", line 197, in build
File "mypy/build.py", line 242, in _build
File "mypy/build.py", line 503, in load_plugins
File "mypy/build.py", line 484, in load_plugins_from_config
File "/home/runner/work/beep-backend/beep-backend/.venv/lib/python3.11/site-packages/mypy_django_plugin/main.py", line 77, in __init__
self.django_context = DjangoContext(self.plugin_config.django_settings_module)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/runner/work/beep-backend/beep-backend/.venv/lib/python3.11/site-packages/mypy_django_plugin/django/context.py", line 84, in __init__
apps, settings = initialize_django(self.django_settings_module)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/runner/work/beep-backend/beep-backend/.venv/lib/python3.11/site-packages/mypy_django_plugin/django/context.py", line 68, in initialize_django
apps.populate(settings.INSTALLED_APPS)
File "/home/runner/work/beep-backend/beep-backend/.venv/lib/python3.11/site-packages/django/apps/registry.py", line 116, in populate
app_config.import_models()
File "/home/runner/work/beep-backend/beep-backend/.venv/lib/python3.11/site-packages/django/apps/config.py", line 269, in import_models
self.models_module = import_module(models_module_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 940, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/home/runner/work/beep-backend/beep-backend/.venv/lib/python3.11/site-packages/rest_framework_simplejwt/models.py", line 6, in <module>
from .settings import api_settings
File "/home/runner/work/beep-backend/beep-backend/.venv/lib/python3.11/site-packages/rest_framework_simplejwt/settings.py", line 19, in <module>
"SIGNING_KEY": settings.SECRET_KEY,
^^^^^^^^^^^^^^^^^^^
File "/home/runner/work/beep-backend/beep-backend/.venv/lib/python3.11/site-packages/django/conf/__init__.py", line 111, in __getattr__
raise ImproperlyConfigured("The SECRET_KEY setting must not be empty.")
django.core.exceptions.ImproperlyConfigured: The SECRET_KEY setting must not be empty.
Strangely, this doesn't happen if I run mypy locally, only in CI where setup is basically the same.
I tried running DJANGO_SETTINGS_MODULE=<path to settings> mypy . but it did not work. How can I get this package compatible with mypy?
The text was updated successfully, but these errors were encountered:
Well in a bare django-admin startproject project the secret key is already set in the settings file. I don't see why I or anyone else would ever move it, so that's why I'm asking where else it would be. Genuine interest, not trying to be snarky or something.
Currently our CI is failing due to mypy failing to find SECRET_KEY as used by SimpleJWT.
Strangely, this doesn't happen if I run
mypy
locally, only in CI where setup is basically the same.I tried running
DJANGO_SETTINGS_MODULE=<path to settings> mypy .
but it did not work. How can I get this package compatible with mypy?The text was updated successfully, but these errors were encountered: