直到今天这从来都不是问题,我不知道我做了什么。因此,所有导入错误都是针对django的,这意味着它没有安装,但可以正常运行,只是棉绒布抛出了太多错误而无法使用,我不认为仅禁用棉绒布是一种前进的道路。这是其中一个错误的示例:
{
"resource": "/Users/rki23/Documents/Python/pcc_django/project_portal/views.py",
"owner": "python",
"code": "import-error",
"severity": 8,
"message": "Unable to import 'django.contrib.auth'",
"source": "pylint",
"startLineNumber": 1,
"startColumn": 1,
"endLineNumber": 1,
"endColumn": 1
}
所有其他导入都可以,例如datetime导入可以。正如我提到的那样,我的网站仍然可以正常运行,只是pylint无法正常工作。所有这些都应该在anaconda虚拟环境中运行,但是我不确定如何显示这一点。这也是我的工作区settings.json
{
"python.linting.pylintEnabled": true,
"python.linting.enabled": true,
"python.linting.pycodestyleEnabled": false,
"python.pythonPath": "/Users/rki23/anaconda3/envs/django_env/bin/python",
"sqltools.connections": [
{
"database": "******",
"dialect": "PostgreSQL",
"name": "Development",
"password": "**********",
"port": 5432,
"server": "localhost",
"username": "********"
}
]
}
这是launch.json:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Django",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/manage.py",
"args": [
"runserver",
"--noreload"
],
"django": false
}
]
}
我希望收到有关django的评论:false,建议您解决另一个问题,但是就像8个月前一样,直到今天它一直运行良好,将其更改为true不能解决此问题。
更新,由于django不符合pep8,现在情况变得更糟了,昨天一个文件中一个文件中现在有41个错误。我如何才能将linting的linting完全重置为默认值。