launch.json 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. {
  2. "version": "0.2.0",
  3. "configurations": [
  4. // 迁移命令配置
  5. {
  6. "name": "Django: Make Migrations",
  7. "type": "python",
  8. "request": "launch",
  9. "program": "${workspaceFolder}/manage.py",
  10. "args": ["makemigrations"],
  11. "console": "integratedTerminal"
  12. },
  13. {
  14. "name": "Django: Migrate",
  15. "type": "python",
  16. "request": "launch",
  17. "program": "${workspaceFolder}/manage.py",
  18. "args": ["migrate"],
  19. "console": "integratedTerminal"
  20. },
  21. // 主服务器配置(带端口绑定)
  22. {
  23. "name": "Django: Run Server (0.0.0.0:8008)",
  24. "type": "python",
  25. "request": "launch",
  26. "program": "${workspaceFolder}/manage.py",
  27. "args": [
  28. "runserver",
  29. "--noreload", // 防止自动重载干扰调试
  30. "0.0.0.0:8008" // 同时设置 IP 和端口
  31. ],
  32. "django": true,
  33. "console": "integratedTerminal"
  34. },
  35. // 带自动迁移的服务器配置(推荐)
  36. {
  37. "name": "Django: Auto Migrate & Run (0.0.0.0:8008)",
  38. "type": "python",
  39. "request": "launch",
  40. "program": "${workspaceFolder}/manage.py",
  41. "args": [
  42. "runserver",
  43. "--noreload",
  44. "0.0.0.0:8008"
  45. ],
  46. "django": true,
  47. "preLaunchTask": "django-auto-migrate",
  48. "console": "integratedTerminal"
  49. }
  50. ],
  51. "compounds": [
  52. // 一键执行迁移+服务器
  53. {
  54. "name": "Django: Full Setup (0.0.0.0:8008)",
  55. "configurations": [
  56. "Django: Make Migrations",
  57. "Django: Migrate",
  58. "Django: Run Server (0.0.0.0:8008)"
  59. ]
  60. }
  61. ]
  62. }