LoginSignup
1
4

More than 1 year has passed since last update.

DjangoのHTML(django-html)をVSCodeで自動的に認識してほしい

Posted at

困ったこと

Djangoで使うHTMLファイルをVSCodeで開くと、django-htmlと認識してもらえず、HTMLと認識されてしまいました。機能拡張の"Django"を入れていましたが、この機能の恩恵をすぐに受けられず、ちょっとストレス感がありました。

拡張機能 Django

解決方法

VSCodeの設定を変更します。
cmd+,のショートカットキーで、設定を開きます。
Files:Associationsの項目に下図のように、django-htmlを認識する条件をつけられるようになりました。

  • Item: **/templates/**/*.html
  • Value: django-html

image.png

もしくは、settings.json に追加する場合は下のようになります。

  "files.associations": {
    "*.html": "html",
    "**/templates/**/*.html": "django-html"
  },

参考

1
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
1
4