首頁  >  問答  >  主體

visual-studio-code - VS coed中python django语法报错问题


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

黄舟黄舟2741 天前918

全部回覆(2)我來回復

  • ringa_lee

    ringa_lee2017-04-18 10:18:52

    裝下 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"

    }

    回覆
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-18 10:18:52

    warning的原因是使用了tab,錯誤的原因應該是models.Article類別設計的有點問題,否則不可能出現Artilce.objects.all()報錯,題主把程式碼貼出來(包括models.py)看一下(放pre裡面)。

    回覆
    0
  • 取消回覆