0
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Djangoスタートアップ ~デバッグ環境構築編(vscode)~

0
Last updated at Posted at 2023-02-28

.vscodeフォルダを新規作成。以下の二つのファイルを新規作成して.vscodeフォルダ内に保存

  • launch.json★デバッグ実行ファイル
  • settings.json ★vscodeの設定ファイル

※ブレークポイントでストップできる最小限の構成を紹介するのでデバッグ実行ファイル.launch.jsonの中身のみ掲載

launch.json
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Django",★デバッグ実行名(任意)
            "type": "python",★使用するデバッガ
            "request": "launch",★デバッグの実行モード※1
            "program": "${workspaceFolder}/manage.py",★デバッグ対象のプログラムのパス
            "console": "integratedTerminal",結果の出力コンソール
            "args": [★python mange.pyに続く引数
                "runserver",
                "0.0.0.0:8000",
                "--noreload",
//                "--nothreading"
            ],
            "django": true,
            "stopOnEntry": false,
            "justMyCode": false2
        },
        {
            "name": "Python",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal"

        }
    ]
}

※1 launchはプログラムの起動時からデバッグ開始, attachは起動しているプログラムに対してデバッグをする

※2 Breakpoint in file excluded by filters. Note: may be excluded because of "justMyCode" option (default == true). Try setting "justMyCode": false in the debug configuration (e.g., launch.json).
の警告がでてブレークポイントで止まらない現象が起こっていたため
justMyCode : falseで対応

参考記事
https://amateur-engineer-blog.com/vscode-launchjson/

0
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?