“MimeType ошибка Django React” Ответ

MimeType ошибка Django React

The reason behind why it shows mime type error is that, staticfiles_dirs doesn't include src folder, and if there is images inside src, it doesn't get include in staticfiles folder while collectstatic process, hence throws error.

so make sure to not use import images inside src or public, instead host them.
Suraj Kr Thapa

MimeType ошибка Django React

Upon deploying the web app in Heroku, one of the common issues that occur 
is the static files failing to load due to MIME type limitations. 
The particular MIME type (text/html) problem is related
to your Django configuration.

The views.py in your React frontend needs 
a content_type argument in the HttpResponse.
Heroku needs to know where the static files are.

The "refused to execute script ... MIME type ('text/html')" problem 
stems from Django's default content_type setting for an HttpResponse, 
which is text/html.

This can be fixed by including a content_type='application/javascript' 
argument in the return statement of a 
new class-based view called Assets(View) inside views.py like so:

for more info visit:
https://dev.to/mdrhmn/deploying-react-django-app-using-heroku-2gfa
Suraj Kr Thapa

Ответы похожие на “MimeType ошибка Django React”

Вопросы похожие на “MimeType ошибка Django React”

Больше похожих ответов на “MimeType ошибка Django React” по Python

Смотреть популярные ответы по языку

Смотреть другие языки программирования