简体   繁体   中英

How do I import this module in python

image showing directories and code

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

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM