Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

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.
Comment

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
Comment

PREVIOUS NEXT
Code Example
Python :: how to filter out all NaN values in pandas df 
Python :: reject invalid input using a loop in python 
Python :: py-trello add card 
Python :: how to make all time greeter using python 
Python :: find common words in two lists python 
Python :: pygame change icon 
Python :: yum install python3 
Python :: where to find python interpreter 
Python :: sqlalchemy delete by id 
Python :: how to add space before capital letter in python 
Python :: pytz timezone list 
Python :: django datetimefield default 
Python :: the user to enter their name and display each letter in their name on a separate line python 
Python :: not importing local folder python 
Python :: Removing all non-numeric characters from string in Python 
Python :: take off character in python string 
Python :: identify prime numbers python 
Python :: count plot 
Python :: replace multiple spaces with single space python 
Python :: python pil bytes to image 
Python :: static dir in django python 
Python :: chrome selenium python 
Python :: how to move a column to last in pandas 
Python :: boston dataset sklearn 
Python :: get all files within multiple directories python 
Python :: NameError: name ‘pd’ is not defined 
Python :: how to insert sound in python 
Python :: conda specify multiple channels 
Python :: load static files in django 
Python :: ec2 upgrade python 3.7 to 3.8 
ADD CONTENT
Topic
Content
Source link
Name
4+7 =