“Błąd mimetypu Django React” Kod odpowiedzi

Błąd mimetypu 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

Błąd mimetypu 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

Odpowiedzi podobne do “Błąd mimetypu Django React”

Pytania podobne do “Błąd mimetypu Django React”

Więcej pokrewnych odpowiedzi na “Błąd mimetypu Django React” w Python

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu