Warm tip: This article is reproduced from stackoverflow.com, please click
python pycharm

How do I import this module in python

发布于 2020-03-29 21:00:36

image showing directories and code

I'mm trying to import views.py I've already tried import personal_portfolio.hello_world.views

Questioner
usermine12
Viewed
41
jaswanth 2020-01-31 18:35

If you are using python3 you need to do a relative import instead of absolute so change import views to from . import views

and in django it is always good to import with whole relative path Eg: from hello_world import views