1
1

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 1 year has passed since last update.

[Django] DEBUG=False時にMIME typeがtext/htmlとなってしまいcssが読み込めなくなった。jsも404。

Last updated at Posted at 2022-02-11

現象

cssのMIME typeがtext/htmlだから読み込めない問題が急に発生。
スクリーンショット 2022-02-11 10.59.03.png

解決策

settings.pyなどの修正は必要なく、サーバの起動コマンドに--insecureを追加するだけで解決した。

python manage.py runserver 0.0.0.0:8000 --insecure

どうやらsettings.pyのDEBUG=Fasleだと本番モードで起動されるみたいで、insecureモードじゃないとstaticファイルが公開されないみたい。
https://github.com/MoriTomo7315/django_gpxtoimage/blob/main/gpxtoimage/settings.py#L50

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?