“MIMETYPE ERROR DJANGO REACT” Réponses codées

MIMETYPE ERROR 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 ERROR 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

Réponses similaires à “MIMETYPE ERROR DJANGO REACT”

Questions similaires à “MIMETYPE ERROR DJANGO REACT”

Plus de réponses similaires à “MIMETYPE ERROR DJANGO REACT” dans Python

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code