Possibly because of my noobness, I can't get pylint and django management commands to agree about how to import files in my project.
Setup
# venv
cd $(mktemp -d)
virtualenv venv
venv/bin/pip install django pylint pylint-django
# django
venv/bin/django-admin startproject foo
touch foo/__init__.py
touch foo/foo/models.py
# management command
mkdir -p foo/foo/management/commands
touch foo/foo/management/__init__.py
touch foo/foo/management/commands/__init__.py
echo -e "import foo.models\nclass Command:\n  def run_from_argv(self, options):\n    pass" > foo/foo/management/commands/pa.py
# install
perl -pe 's/(INSTALLED_APPS = \[)$/\1 "foo",\n/' -i foo/foo/settings.py
# testing
venv/bin/python foo/manage.py pa
venv/bin/pylint --load-plugins pylint_django --django-settings-module=foo.foo.settings --errors-only foo
Result
You'll note that manage.py is happy with import foo.models, but pylint isn't:
************* Module foo.foo.management.commands.pa
foo/foo/management/commands/pa.py:1:0: E0401: Unable to import 'foo.models' (import-error)
foo/foo/management/commands/pa.py:1:0: E0611: No name 'models' in module 'foo' (no-name-in-module)
If I change it to import foo.foo.models, pylint passes but manage.py breaks:
...
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/tmp/tmp.YnQCNTrkbX/foo/foo/management/commands/pa.py", line 1, in <module>
    import foo.foo.models
ModuleNotFoundError: No module named 'foo.foo'
What am I missing?
 
    