Django服务器已打开,但是通过localhost能访问,用本机IP却不行。
办法很简单,只需要./.vscode/launch.json
中添加启动参数。
launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Django",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/manage.py",
"args": [
"runserver",
"0.0.0.0:8000" //关键
],
"django": true
}
]
}