![](/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.