Question

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.

Was it helpful?

Solution

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.

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top