(Django tutorial) importing 'views' from 'polls' app - syntax error PyCharm

我与影子孤独终老i 提交于 2020-08-23 03:52:48

问题


Is it incorrect to use:

from [app name] import views

when you're inside that app?

I'm following the tutorial from the Django documentation website; and everything is working; however, I'm getting a syntax error (it still works though) every time I do the following:

enter image description here

*I'm using PyCharm


回答1:


If you right click the mysite.com/mysite folder and select Mark Directory As -> Source Root you should be able to do from polls import views



来源:https://stackoverflow.com/questions/17012558/django-tutorial-importing-views-from-polls-app-syntax-error-pycharm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!