(Django教程)从``民意调查''应用程序导入``视图''-语法错误PyCharm [英] (Django tutorial) importing 'views' from 'polls' app - syntax error PyCharm

查看:51
本文介绍了(Django教程)从``民意调查''应用程序导入``视图''-语法错误PyCharm的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用不正确吗?

from [app name] import views

当您使用该应用程序时?

when you're inside that app?

我正在遵循Django文档网站上的教程;一切都在工作;但是,每次执行以下操作时,我都会收到语法错误(尽管它仍然有效):

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:

*我正在使用PyCharm

*I'm using PyCharm

推荐答案

如果右键单击 mysite.com/mysite 文件夹,然后选择 Mark Directory As->.源根,您应该能够从民意测验导入视图中执行

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

这篇关于(Django教程)从``民意调查''应用程序导入``视图''-语法错误PyCharm的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆