“Mimetyp -Fehler Django reagieren” Code-Antworten

Mimetyp -Fehler Django reagieren

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

Mimetyp -Fehler Django reagieren

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

Ähnliche Antworten wie “Mimetyp -Fehler Django reagieren”

Fragen ähnlich wie “Mimetyp -Fehler Django reagieren”

Weitere verwandte Antworten zu “Mimetyp -Fehler Django reagieren” auf Python

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen