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
AstroidImportError when ForeignKey points to app not in root module #233
Comments
|
I'm seeing the same issue but there's no reliable way to get this information from Django's INSTALLED_APPS. Applications can define an The solution is to modify the PYTHONPATH variable and instruct pylint where to find these additional modules:
My ForeignKey relations look like |
Add the env variable PYTHONPATH to circleci config to allow pylint to find some models, avoiding crashes pylint-dev/pylint-django#233
Add the env variable PYTHONPATH to circleci config to allow pylint to find some models, avoiding crashes pylint-dev/pylint-django#233
I have a project structure where Django apps live in an
apps/
directory. This makes the import path for a model atapps.myapp.models.MyModel
.When pylint_django processes the ForeignKey, it tries to load
myapp.models
, resulting in anastroid.exceptions.AstroidImportError
. The only way around it as I see is to actually read the contents ofINSTALLED_APPS
settings variable.The text was updated successfully, but these errors were encountered: