![](/img/trans.png)
[英]Error when debugging an Azure function on Visual Studio Code ('LogType' was not present)
[英]Error When Debugging Django project with ImageFields in Visual Studio Code
我花了很长时间解决这个问题,我想发布它以防它帮助其他人。
我在 Visual Studio Code 中有一个 django 项目,我为该项目配置了一个虚拟环境。 在激活我的虚拟环境之后,我将使用manage.py runserver
在集成终端中运行该项目并且该项目有效。 我为 django 项目创建了一个带有默认启动的调试配置。json。 运行调试器,我得到了这个错误:
(fields.E210) Cannot use ImageField because Pillow is not installed.HINT: Get Pillow at https://pypi.org/project/Pillow/ or run command "python -m pip install Pillow".
Pillow 安装在虚拟环境以及我的全局 python 安装中。
注意:我正在运行 Windows 10、python 3.6 和 Django 2.2。
我不知道为什么,但我更改了 launch.json 以使用我的全局 python 安装,它现在可以运行了。 我注意到运行调试器无论如何都会激活虚拟环境,所以这似乎不是问题。 这是对我有用的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",
"pythonPath": "C:\\Users\\<userName>\\AppData\\Local\\Programs\\Python\\Python36\\python.exe",
"type": "python",
"request": "launch",
"program": "manage.py",
"console": "integratedTerminal",
"args": [
"runserver"
],
"django": true
},
]
}
我真正认为重要的唯一更改是 pythonPath,我将保留所有其他默认值 VS Code 集。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.