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
I recently ran into a bug in our dev environment where a setting gave an ImportError using from myapp.mymodule import MY_SETTING, apparently because that setting was defined using environment variables (I'm guessing there may be some lazy loading behavior here that is bypassed by importing the setting directly).
Since pylint-django knows about the application's settings module via DJANGO_SETTINGS_MODULE, would it be possible to flag the incorrect style of import by looking for that module in import statements?
The text was updated successfully, but these errors were encountered:
According to django's docs, settings should be imported using
from django.conf import settings
and not your own settings file; see https://docs.djangoproject.com/en/5.1/topics/settings/#using-settings-in-python-codeI recently ran into a bug in our dev environment where a setting gave an
ImportError
usingfrom myapp.mymodule import MY_SETTING
, apparently because that setting was defined using environment variables (I'm guessing there may be some lazy loading behavior here that is bypassed by importing the setting directly).Since pylint-django knows about the application's settings module via
DJANGO_SETTINGS_MODULE
, would it be possible to flag the incorrect style of import by looking for that module in import statements?The text was updated successfully, but these errors were encountered: