[Answered ]-Django: cant import model to a .py on the same path as models

1👍

Given that directory structure, your import should be working.

How about trying a relative import instead? In both views.py and getnews.py this should work:

from models import ...

1👍

have You tried that?

from .models import newsurls, newsblock 

Please also read about PEP8 http://legacy.python.org/dev/peps/pep-0008/ cause Your code is not formatted correctly.

EDITED: I see that You trying to do that but without ‘.’ sign. Please note that before models is ‘.’ like that .models

Leave a comment