2016-09-13 38 views
4

私はVisual Studio CodeでDjangoアプリケーションのデバッグをしたいと考えています。私は、virtualenvのを持っているlaunch.json次のようになりファイルの変更作ら:virtualenvでDjangoアプリケーションをデバッグするためのVisual Studioコードの設定方法は?

{ 
    "name": "Django", 
    "type": "python", 
    "request": "launch", 
    "stopOnEntry": true, 
    "pythonPath": "${workspaceRoot}/.venv/bin/python2.7", 
    "program": "${workspaceRoot}/mysite/manage.py", 
    "args": [ 
     "runserver" 
    ], 
    "debugOptions": [ 
     "WaitOnAbnormalExit", 
     "WaitOnNormalExit", 
     "DjangoDebugging", 
     "RedirectOutput" 
    ] 
}, 

コードにいくつかのブレークポイントを入れて、それを実行します。残念ながら、実行はブレークポイントのある行で停止されません。私はvirtualenvなしで同じことを試み、すべてが完璧に働いた。

私がここで間違っていることを指摘してください。

答えて

8

この問題を解決できましたか?

は私にとっては、以下の2つの変更は、プロジェクト

を開始しながら、

  1. はここの関連部分ですPYTHONPATH
  2. 使用するための「--noreload」オプションを絶対パスを追加働きました私の設定

    { 
         "name": "Django", 
         "type": "python", 
         "request": "launch", 
         "stopOnEntry": true, 
         "pythonPath": "/Users/xyz/Documents/dev/my_project/my_project_env/bin/python", 
         "program": "${workspaceRoot}/manage.py", 
         "args": [ 
          "runserver", 
          "0.0.0.0:8080", 
          "--noreload"     
         ], 
         "debugOptions": [ 
          "WaitOnAbnormalExit", 
          "WaitOnNormalExit", 
          "RedirectOutput", 
          "DjangoDebugging" 
         ] 
        }, 
    
+0

ウィンドウの 'pythonPath'は(my env)' 'pythonPath": "c:\\ Python3"、 ' –

+0

あなたにお答えいただき、ありがとうございます、Sudheendra。 –

0

1)CTRL +、
2)ワークスペース設定を選択
3)開いた設定ファイルに次の行を追加します。設定が完了し

"python.pythonPath": "path_to_your_env" 


関連する問題