{"id":176,"date":"2020-10-29T22:32:36","date_gmt":"2020-10-29T13:32:36","guid":{"rendered":"http:\/\/localhost:8000\/?p=176"},"modified":"2021-01-17T21:31:10","modified_gmt":"2021-01-17T12:31:10","slug":"poetry-direnv-vscode-debug","status":"publish","type":"post","link":"http:\/\/localhost:8000\/2020\/10\/poetry-direnv-vscode-debug.html","title":{"rendered":"Poetry+direnv\u3067\u74b0\u5883\u7ba1\u7406\u3057\u3066\u3044\u308bPython\u30a2\u30d7\u30ea\u3092VS Code\u4e0a\u3067Debug\u5b9f\u884c\u3059\u308b"},"content":{"rendered":"
\u3053\u3053\u6700\u8fd1Python\u306e\u30ed\u30fc\u30ab\u30eb\u958b\u767a\u74b0\u5883\u306b\u304a\u3044\u3066\u306f\u3001Poetry\u3067\u4eee\u60f3\u74b0\u5883\uff0b\u30d1\u30c3\u30b1\u30fc\u30b8\u7ba1\u7406\u3092\u884c\u3044\u3001direnv\u3067\u74b0\u5883\u5909\u6570\u7ba1\u7406\u3092\u884c\u3046\u30b9\u30bf\u30f3\u30b9\u306a\u306e\u3067\u3059\u304c\u3001VS Code\u4e0a\u3067Debug\u5b9f\u884c\u3057\u3088\u3046\u3068\u601d\u3063\u305f\u3089\u5c11\u3057\u8a2d\u5b9a\u304c\u5fc5\u8981\u3060\u3063\u305f\u306e\u3067\u30e1\u30e2\u7684\u306b\u6b8b\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n
Poetry\u306f\u4eee\u60f3\u74b0\u5883\u69cb\u7bc9\u3068\u30d1\u30c3\u30b1\u30fc\u30b8\u7ba1\u7406\u3092\u307e\u3068\u3081\u3066\u5b9f\u884c\u3067\u304d\u308b\u4fbf\u5229\u306a\u30c4\u30fc\u30eb\u3067\u3059\u3002\u3064\u307e\u308a\u3001venv\u3068pip\u306e\u4ee3\u66ff\u30c4\u30fc\u30eb\u3068\u306a\u308a\u307e\u3059\u3002\u8a73\u7d30\u306f\u4ee5\u524d\u8a18\u4e8b\u3092\u66f8\u3044\u305f\u306e\u3067\u305d\u3061\u3089\u3092\u53c2\u7167\u304f\u3060\u3055\u3044\u3002 12 factor<\/a> \u3092\u610f\u8b58\u3057\u3066\u3001\u8a2d\u5b9a\u306f\u74b0\u5883\u5909\u6570\u306b\u683c\u7d0d\u3059\u308b\u3068\u3044\u3046\u306e\u304c\u4e00\u822c\u7684\u306b\u306a\u3063\u3066\u304d\u3066\u3044\u308b\u3068\u601d\u3044\u307e\u3059\u304c\u3001\u30bf\u30fc\u30df\u30ca\u30eb\u3067\u3042\u308b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b mac\u30e6\u30fc\u30b6\u3067\u3042\u308c\u3070homebrew\u3067\u5165\u308c\u308b\u306e\u304c\u4e00\u756a\u697d\u3060\u3068\u601d\u3044\u307e\u3059\u3002\u305d\u306e\u4ed6\u306e\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u65b9\u6cd5\u306f\u3053\u3061\u3089<\/a>\u3092\u53c2\u7167\u304f\u3060\u3055\u3044\u3002<\/p>\n \u6b21\u306b\u30b7\u30a7\u30eb\u306b\u30d5\u30c3\u30af\u3057\u307e\u3059\u3002Bash\u306e\u5834\u5408\u306f \u3053\u308c\u3067direnv\u304c\u30b7\u30a7\u30eb\u3067\u6709\u52b9\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n \u4efb\u610f\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b \u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3059\u308b\u3068\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b \u3053\u308c\u306b\u3088\u308a\u3001\u3053\u306e\u4f8b\u3067\u306f \u307e\u305a\u3001VS Code\u306eExtensions\u30a2\u30a4\u30b3\u30f3\u304b\u3089Python\u30d7\u30e9\u30b0\u30a4\u30f3<\/a>\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u307e\u3059\u3002<\/p>\n \u6b21\u306b\u3001VS Code\u306eDebug\u30a2\u30a4\u30b3\u30f3\u304b\u3089Debug\u753b\u9762\u3092\u958b\u304d\u3001 \u3053\u306e\u72b6\u614b\u3067\u4efb\u610f\u306epython\u30d5\u30a1\u30a4\u30eb\u3092\u958b\u3044\u3066\u3001 \u305f\u3060\u3057\u3001\u8a2d\u5b9a\u306b\u3088\u3063\u3066\u306f\u4ee5\u4e0b\u306e\u30a8\u30e9\u30fc\u304c\u767a\u751f\u3059\u308b\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002\u305d\u306e\u5834\u5408\u306f\u500b\u5225\u306b\u5bfe\u5fdc\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\n Poetry\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305f\u30d1\u30c3\u30b1\u30fc\u30b8\u304cModuleNotFoundError\u306b\u306a\u308b\u306e\u306f\u3001Poetry\u306e\u4eee\u60f3\u74b0\u5883\u3092VS Code\u304c\u8a8d\u8b58\u3067\u304d\u3066\u306a\u3044\u305f\u3081\u3067\u3059\u3002\u305d\u306e\u305f\u3081\u3001\u8a8d\u8b58\u3055\u305b\u3066\u3042\u3052\u308c\u3070OK\u3067\u3059\u3002<\/p>\n \u4e00\u3064\u76ee\u306e\u65b9\u6cd5\u306f\u3001 \u4e8c\u3064\u76ee\u306e\u65b9\u6cd5\u306f\u3001\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u5185\u306b\u4eee\u60f3\u74b0\u5883\u3092\u4f5c\u3063\u3066\u3057\u307e\u3046\u65b9\u6cd5\u3067\u3059\u3002 <\/p>\n VS Code\u306ePython\u306eDebugger\u306f\u8ce2\u304f\u3066\u3001\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u5185\u306bvenv\u306e\u4eee\u60f3\u74b0\u5883\u304c\u3042\u308b\u5834\u5408\u306f\u305d\u306e\u4eee\u60f3\u74b0\u5883\u3092activate\u3057\u3066\u304f\u308c\u308b\u305f\u3081\u3001Poetry\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305f\u30d1\u30c3\u30b1\u30fc\u30b8\u3082\u3061\u3083\u3093\u3068\u8a8d\u8b58\u3057\u3066\u3055\u308c\u307e\u3059\u3002 <\/p>\n VS Code\u306eDebug\u5b9f\u884c\u3067\u8d77\u52d5\u3055\u308c\u308b\u30b7\u30a7\u30eb\u306f\u30ed\u30b0\u30a4\u30f3\u30b7\u30a7\u30eb\u3067\u306f\u306a\u3044\u305f\u3081\u3001 \u3053\u3061\u3089\u3082\u5bfe\u51e6\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n \u4e00\u3064\u76ee\u306f\u3001direnv\u306e\u30d5\u30c3\u30af\u306e\u51e6\u7406\u3092\u3061\u3083\u3093\u3068 \u4e8c\u3064\u76ee\u306f\u3001direnv\u3092\u7d4c\u7531\u305b\u305a\u306bDebug\u5b9f\u884c\u6642\u306b\u76f4\u63a5\u74b0\u5883\u5909\u6570\u3092\u53d6\u308a\u8fbc\u3080\u65b9\u6cd5\u3067\u3059\u3002 \u305d\u3057\u3066\u3001\u4e0a\u8a18 \u4e00\u3064\u76ee\u306e\u5bfe\u5fdc\u306f\u5f53\u7136\u3084\u308b\u3068\u3057\u3066\u3001\u500b\u4eba\u7684\u306b\u306f\u4e8c\u3064\u76ee\u306e\u5bfe\u5fdc\u3082\u3084\u308b\u3053\u3068\u306b\u3057\u307e\u3057\u305f\u3002\u4eca\u5f8cDocker\u4e0a\u3067\u5b9f\u884c\u3057\u305f\u304f\u306a\u3063\u305f\u6642\u3068\u304b\u306b\u3001 \u30c7\u30d5\u30a9\u30eb\u30c8\u3060\u3068\u81ea\u5206\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u5185\u306e\u30b3\u30fc\u30c9\u3057\u304bDebug\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u306a\u3044\u306e\u3067\u3059\u304c\u3001 \u3053\u3053\u6700\u8fd1Python\u306e\u30ed\u30fc\u30ab\u30eb\u958b\u767a\u74b0\u5883\u306b\u304a\u3044\u3066\u306f\u3001Poetry\u3067\u4eee\u60f3\u74b0\u5883\uff0b\u30d1\u30c3\u30b1\u30fc\u30b8\u7ba1\u7406\u3092\u884c\u3044\u3001direnv\u3067\u74b0\u5883\u5909\u6570\u7ba1\u7406\u3092\u884c\u3046\u30b9\u30bf\u30f3\u30b9\u306a\u306e\u3067\u3059\u304c\u3001VS Code\u4e0a\u3067Debug\u5b9f\u884c\u3057\u3088\u3046\u3068\u601d\u3063\u305f\u3089\u5c11\u3057\u8a2d\u5b9a\u304c\u5fc5\u8981\u3060\u3063\u305f\u306e\u3067\u30e1\u30e2\u7684\u306b\u6b8b\u3057\u3066\u304a\u304d\u307e\u3059\u3002 Poetry Poetry\u306f\u4eee\u60f3\u74b0\u5883\u69cb\u7bc9\u3068\u30d1\u30c3\u30b1\u30fc\u30b8\u7ba1\u7406\u3092\u307e\u3068\u3081\u3066\u5b9f\u884c\u3067\u304d\u308b\u4fbf\u5229\u306a\u30c4\u30fc\u30eb\u3067\u3059\u3002\u3064\u307e\u308a\u3001venv\u3068pip\u306e\u4ee3\u66ff\u30c4\u30fc\u30eb\u3068\u306a\u308a\u307e\u3059\u3002\u8a73\u7d30\u306f\u4ee5\u524d\u8a18\u4e8b\u3092\u66f8\u3044\u305f\u306e\u3067\u305d\u3061\u3089\u3092\u53c2\u7167\u304f\u3060\u3055\u3044\u3002 poetry\u3067\u30d1\u30c3\u30b1\u30fc\u30b8\u30fb\u4eee\u60f3\u74b0\u5883\u3092\u7ba1\u7406 direnv 12 factor \u3092\u610f\u8b58\u3057\u3066\u3001\u8a2d\u5b9a\u306f\u74b0\u5883\u5909\u6570\u306b\u683c\u7d0d\u3059\u308b\u3068\u3044\u3046\u306e\u304c\u4e00\u822c\u7684\u306b\u306a\u3063\u3066\u304d\u3066\u3044\u308b\u3068\u601d\u3044\u307e\u3059\u304c\u3001\u30bf\u30fc\u30df\u30ca\u30eb\u3067\u3042\u308b\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306bcd\u3057\u305f\u3055\u3044\u306b\u3001\u73fe\u5728\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3082\u3057\u304f\u306f\u89aa\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u63a2\u7d22\u3057\u3066\u3001.envrc\u304c\u5b58\u5728\u3057\u3066\u3044\u305f\u5834\u5408\u305d\u3053\u306b\u8a18\u8f09\u3055\u308c\u3066\u3044\u308b\u5185\u5bb9\u3092\u74b0\u5883\u5909\u6570\u306b\u30ed\u30fc\u30c9\u3057\u3066\u304f\u308c\u308b\u4fbf\u5229\u306a\u30c4\u30fc\u30eb\u3067\u3059\u3002\u5225\u306e\u30c7 <\/span>Continue Reading<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[20,7],"tags":[],"_links":{"self":[{"href":"http:\/\/localhost:8000\/wp-json\/wp\/v2\/posts\/176"}],"collection":[{"href":"http:\/\/localhost:8000\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/localhost:8000\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/localhost:8000\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/localhost:8000\/wp-json\/wp\/v2\/comments?post=176"}],"version-history":[{"count":1,"href":"http:\/\/localhost:8000\/wp-json\/wp\/v2\/posts\/176\/revisions"}],"predecessor-version":[{"id":177,"href":"http:\/\/localhost:8000\/wp-json\/wp\/v2\/posts\/176\/revisions\/177"}],"wp:attachment":[{"href":"http:\/\/localhost:8000\/wp-json\/wp\/v2\/media?parent=176"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/localhost:8000\/wp-json\/wp\/v2\/categories?post=176"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/localhost:8000\/wp-json\/wp\/v2\/tags?post=176"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}
\npoetry\u3067\u30d1\u30c3\u30b1\u30fc\u30b8\u30fb\u4eee\u60f3\u74b0\u5883\u3092\u7ba1\u7406<\/a><\/p>\ndirenv<\/a><\/h2>\n
cd<\/code>\u3057\u305f\u3055\u3044\u306b\u3001\u73fe\u5728\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3082\u3057\u304f\u306f\u89aa\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u3092\u63a2\u7d22\u3057\u3066\u3001
.envrc<\/code>\u304c\u5b58\u5728\u3057\u3066\u3044\u305f\u5834\u5408\u305d\u3053\u306b\u8a18\u8f09\u3055\u308c\u3066\u3044\u308b\u5185\u5bb9\u3092\u74b0\u5883\u5909\u6570\u306b\u30ed\u30fc\u30c9\u3057\u3066\u304f\u308c\u308b\u4fbf\u5229\u306a\u30c4\u30fc\u30eb\u3067\u3059\u3002\u5225\u306e\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306b\u79fb\u52d5\u3057\u305f\u969b\u306f\u3001\u74b0\u5883\u5909\u6570\u306f\u30a2\u30f3\u30ed\u30fc\u30c9\u3055\u308c\u307e\u3059\u3002<\/p>\n
\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb<\/h3>\n
brew install direnv<\/code><\/pre>\n
.bashrc<\/code>\u306b\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u8a18\u8f09\u3057\u307e\u3059\u3002\u305d\u306e\u4ed6\u306e\u30b7\u30a7\u30eb\u306e\u65b9\u306f\u3053\u3061\u3089<\/a>\u3092\u53c2\u7167\u304f\u3060\u3055\u3044\u3002<\/p>\n
eval "$(direnv hook bash)"<\/code><\/pre>\n
\u8a2d\u5b9a<\/h3>\n
.envrc<\/code>\u3092\u4f5c\u6210\u3057\u3066\u3001\u8a2d\u5b9a\u3057\u305f\u3044\u74b0\u5883\u5909\u6570\u3092\u8a18\u8f09\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n
export PROJECT_DIR=\/hoge\/fuga\nexport PROJECT_ID=fuga\nexport PYTHONPATH="${PROJECT_DIR}:${PYTHONPATH}"<\/code><\/pre>\n
.envrc<\/code>\u304c\u30d6\u30ed\u30c3\u30af\u3055\u308c\u3066\u3044\u308b\u3068\u3044\u3046\u30a8\u30e9\u30fc\u304c\u51fa\u307e\u3059\u306e\u3067\u3001<\/p>\n
direnv: error \/hoge\/fuga\/.envrc is blocked. Run `direnv allow` to approve its content<\/code><\/pre>\n
direnv allow<\/code>\u30b3\u30de\u30f3\u30c9\u3067\u30d6\u30ed\u30c3\u30af\u3092\u89e3\u9664\u3057\u3066\u3042\u3052\u307e\u3059\u3002\u4ee5\u5f8c
.envrc<\/code>\u306e\u5185\u5bb9\u3092\u5909\u66f4\u3059\u308b\u305f\u3073\u306b
direnv allow<\/code>\u3092\u884c\u3046\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n
direnv allow\ndirenv: loading \/hoge\/fuga\/.envrc\ndirenv: export +PROJECT_DIR +PROJECT_ID +PYTHONPATH<\/code><\/pre>\n
PROJECT_DIR<\/code>
PROJECT_ID<\/code>
PYTHONPATH<\/code>\u304c\u74b0\u5883\u5909\u6570\u306b\u683c\u7d0d\u3055\u308c\u307e\u3057\u305f\u3002
\n\u4ee5\u5f8c\u306f\u3001\u30b7\u30a7\u30eb\u3067\u3053\u306e\/hoge\/fuga<\/code>\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u914d\u4e0b\u306b
cd<\/code>\u3057\u305f\u3060\u3051\u3067\u81ea\u52d5\u7684\u306b
.envrc<\/code>\u306b\u8a18\u8f09\u3055\u308c\u3066\u3044\u308b\u5185\u5bb9\u304c\u74b0\u5883\u5909\u6570\u306b\u683c\u7d0d\u3055\u308c\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n
VS Code\u3067Debug\u5b9f\u884c<\/h2>\n
\u901a\u5e38\u306ePython Debug\u74b0\u5883\u6e96\u5099<\/h3>\n
Add Configration...<\/code>\u3092\u30af\u30ea\u30c3\u30af\u3057\u3001
Python File<\/code>\u3092\u9078\u629e\u3059\u308b\u3068\u3001\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306e
launch.json<\/code>\u304c\u4f5c\u6210\u3055\u308c\u307e\u3059\u3002<\/p>\n
{\n "version": "0.2.0",\n "configurations": [\n {\n "name": "Python: Current File",\n "type": "python",\n "request": "launch",\n "program": "${file}",\n "console": "integratedTerminal"\n }\n ]\n}<\/code><\/pre>\n
Start Debugging<\/code>\u30a2\u30a4\u30b3\u30f3\u3092\u30af\u30ea\u30c3\u30af\u3059\u308b\u304b
F5<\/code>\u3067Debug\u3092\u30b9\u30bf\u30fc\u30c8\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n
\n
Poetry\u3067\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305f\u30d1\u30c3\u30b1\u30fc\u30b8\u304cModuleNotFoundError\u306b\u306a\u308b\u30b1\u30fc\u30b9\u306e\u5bfe\u51e6<\/h3>\n
.vscode\/settings.json<\/code>\u306bPoetry\u306e\u4eee\u60f3\u74b0\u5883\u306epython\u306epath\u3092\u76f4\u63a5\u6307\u5b9a\u3059\u308b\u65b9\u6cd5\u3067\u3059\u3002
\npath\u306fpoetry env info<\/code>\u3067\u78ba\u8a8d\u3057\u3066\u3001 <\/p>\n
poetry env info\n\n> Virtualenv\n> Python: 3.9.0\n> Implementation: CPython\n> Path: \/Users\/xxxxx\/Library\/Caches\/pypoetry\/virtualenvs\/myproject-xxxxxxx-py3.9\n> Valid: True<\/code><\/pre>\n
.vscode\/settings.json<\/code>\u306bpythonpath\u3068\u3057\u3066\u305d\u306epath\u3092\u8a18\u8f09\u3057\u307e\u3059\u3002<\/p>\n
{\n "python.pythonPath": "\/Users\/xxxxx\/Library\/Caches\/pypoetry\/virtualenvs\/myproject-xxxxxxx-py3.9"\n}<\/code><\/pre>\n
poetry config virtualenvs.in-project true # --local\u30aa\u30d7\u30b7\u30e7\u30f3\u3092\u3064\u3051\u308b\u3068\u8a2d\u5b9a\u7bc4\u56f2\u3092\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u5185\u306b\u9650\u5b9a\npoetry env remove myproject-xxxxxxx-py3.9 # \u3059\u3067\u306b\u4eee\u60f3\u74b0\u5883\u3092\u4f5c\u3063\u3066\u3057\u307e\u3063\u3066\u3044\u308b\u5834\u5408\u306e\u307f\npoetry env use python # \u4eee\u60f3\u74b0\u5883\u3092\u69cb\u7bc9<\/code><\/pre>\n
source \/Users\/xxxxx\/workplace\/myproject.venv\/bin\/activate<\/code><\/pre>\n
direnv\u3067\u8a2d\u5b9a\u3057\u305f\u306f\u305a\u306e\u74b0\u5883\u5909\u6570\u304c\u53c2\u7167\u3067\u304d\u306a\u3044\u30b1\u30fc\u30b9\u306e\u5bfe\u51e6<\/h3>\n
.bash_profile<\/code>\u306f\u8aad\u307f\u8fbc\u307e\u308c\u307e\u305b\u3093\u3002direnv\u306f\u30d5\u30c3\u30af\u3092\u30b7\u30a7\u30eb\u306b\u767b\u9332\u3059\u308b\u3053\u3068\u3067\u74b0\u5883\u5909\u6570\u683c\u7d0d\u3092\u5b9f\u884c\u3059\u308b\u306e\u3067\u3059\u304c\u3001\u3053\u306e\u30d5\u30c3\u30af\u306e\u767b\u9332\u3092
.bash_profile<\/code>\u3067\u884c\u3063\u3066\u3044\u308b\u3068\u3001Debug\u5b9f\u884c\u6642\u306b\u74b0\u5883\u5909\u6570\u304c\u8aad\u307f\u8fbc\u307e\u308c\u306a\u3044\u3068\u3044\u3046\u554f\u984c\u304c\u767a\u751f\u3057\u307e\u3059\u3002<\/p>\n
.bashrc<\/code>\u306b\u8a18\u8f09\u3059\u308b\u3068\u3044\u3046\u5bfe\u5fdc\u3067\u3059\u3002\u57fa\u672c\u306f\u3053\u308c\u3067\u5bfe\u5fdc\u3059\u3079\u304d\u3067\u3059\u3002<\/p>\n
\ndirenv\u306f.envrc<\/code>\u306b\u4ee5\u4e0b\u306e\u3088\u3046\u306b
dotenv<\/code>\u3068\u3060\u3051\u66f8\u3044\u3066\u304a\u304f\u3068
.env<\/code>\u30d5\u30a1\u30a4\u30eb\u306e\u5185\u5bb9\u3092\u898b\u306b\u884c\u304f\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n
dotenv<\/code><\/pre>\n
.env<\/code>\u30d5\u30a1\u30a4\u30eb\u306b\u306f\u3001
KEY=VALUE<\/code>\u306e\u5f62\u5f0f\u3067\u74b0\u5883\u5909\u6570\u3092\u8a18\u8f09\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n
PROJECT_DIR=\/hoge\/fuga\nPROJECT_ID=fuga\nPYTHONPATH="${PROJECT_DIR}:${PYTHONPATH}"<\/code><\/pre>\n
.env<\/code>\u306f\u3001
launch.json<\/code>\u306b\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u8a2d\u5b9a\u3057\u3066\u304a\u304f\u3053\u3068\u3067\u3001Debug\u5b9f\u884c\u6642\u306b\u74b0\u5883\u5909\u6570\u3068\u3057\u3066\u8aad\u307f\u8fbc\u307e\u308c\u307e\u3059\u3002<\/p>\n
{\n "configurations": [\n {\n "envFile": "${workspaceFolder}\/.env",\n }\n ]\n}<\/code><\/pre>\n
.env<\/code>\u306e\u5f62\u5f0f\u3067\u3042\u308c\u3070\u305d\u306e\u307e\u307e\u4f7f\u3044\u307e\u308f\u305b\u308b\u305f\u3081\u3067\u3059\u3002<\/p>\n
\u305d\u306e\u4ed6Tips<\/h2>\n
\u30d1\u30c3\u30b1\u30fc\u30b8\u5185\u306e\u30b3\u30fc\u30c9\u3082Debug<\/h3>\n
launch.json<\/code>\u306b\u4ee5\u4e0b\u306e\u8a2d\u5b9a\u3092\u884c\u3046\u3053\u3068\u3067\u3001\u30d1\u30c3\u30b1\u30fc\u30b8\u5185\u306e\u30b3\u30fc\u30c9\u3082Debug\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n
{\n "configurations": [\n {\n "justMyCode": false,\n }\n ]\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"