No module named "pages"

So I am following this tutorial https://www.youtube.com/watch?v=F5mRW0jo-U4&t=3669s . I have all the code right. In 1:04:55 there is code that says from pages import views. But the console says this when I run the server ModuleNotFoundError: No module named ‘pages’. But in the tutorial it shows no error what could this be ?

1 Like

Hi, it seems tricky but it’s all about how python modules works

Possible Solution: If you read the comments under urls.py in the video, there is an explanation that says from my_app import views, so, if your app is called pages, it should work, but if don’t, that is the problem, you need to write "from your_app_name import views and it should work.

When you write from pages import views What python is really doing is: "Is there any module (reachable folder) called pages, that contains a property, named views? and them if Python doesn’t find it, the next question is: Is there any installed module in this environment called pages with a property called views?

Wish this help you!

Thank you so much I have been trying everything and only this helped.

1 Like

Glad to help you! :grin:

Have a nice job :computer: