agiliq
agiliq

Reputation: 7758

PyLint failing for a number of Django imports

I am using PyLint,

pylint -e app/views.py

Gives me errors like

E:  3: No name 'shortcuts' in module 'django'
E:  7: No name 'db' in module 'django'

But passes for other django imports. Since it passes for other Django import Django is on my pythonpath.

Upvotes: 1

Views: 2146

Answers (2)

gurney alex
gurney alex

Reputation: 13655

Have you tried djangolint, which is a wrapper around Pylint with Django-specific settings?

Upvotes: 1

jtjin
jtjin

Reputation: 510

I think I figured it out -- if you jump into a python session and actually try to import anything from django.db

from django.db import *

you'll get an error about DJANGO_SETTINGS_MODULE not being set. Setting the environment variable and pointing it to your settings.py like app.settings should fix the error for you.

When I tried this in an Eclipse/PyDev config I had to disable pylint, build, then re-enable pylint to finally clear out those errors.

Upvotes: 1

Related Questions