[Answer]-ImportError: No module named lop.models

0đź‘Ť

âś…

So I figured out the problem which was from a fault on my part.

For the longest time, I thought that to test for any compilation errors (syntax), I would run “python < filename > migrate” or “python < filename > makemigrations” on the shell. My belief was that all changes needed to be migrated and not just ones in the database. I get errors messages when syntax mistake including this one and it has worked in other cases before. Someone eventually pointed out to me that is NOT how you test it and running “python manage.py runserver 0.0.0.0:8000” would point out any errors in the code in your local machine. I got no error messages for my specific file after that.

Gabriel L’Heureux, I still appreciated your help (I would give you a point up for it but I don’t have enough points to do so) so you have my thanks.

👤ChocolateCode

1đź‘Ť

I am not familiar with django, but here’s what I do in that kind of situation:

import sys
sys.path.append('/path/of/folder/where/module/is/')
from new_module import new_function

Leave a comment