visual-studio-code - VS coed中python django语法报错问题
黄舟
黄舟 2017-04-18 10:16:52
0
2
920


pylint红线是报错
不知是vs code的问题 还是代码的问题
另外代码应该是没问题
不知道怎么解决

黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

Antworte allen(2)
左手右手慢动作

装下 pylint-django

https://github.com/landscapei...
Prevents warnings about Django-generated attributes such as Model.objects or Views.request.

正在整理用vscode开发django项目的文档,等我更新

  1. 在 vscode 中按下 Ctrl + Shift + P,输入 workspace,选择 Preferences: Open Workspace Settings,配置完成后的JSON文件如下
    {

"python.pythonPath": "e:/temp/django_demo/env/scripts/python.exe",
"python.linting.pylintPath": "pylint",
"python.linting.pylintArgs": [
    "--load-plugins", "pylint_django"

],
"python.formatting.autopep8Path": "autopep8"

}

伊谢尔伦

warning的原因是使用了tab,错误的原因应该是models.Article类设计的有点问题,否则不可能出现Artilce.objects.all()报错,题主把代码贴出来(包括models.py)看一下(放pre里面)。

Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage
Über uns Haftungsausschluss Sitemap
Chinesische PHP-Website:Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!