Hi. I’m new to Django and pyinstaller, and I’m a new member of a team that has inherited a Django project that’s being built using pyinstaller.
When we build our installer with DEBUG = True (the default), it works fine.
We can load images, .js, .css etc. just fine.
When we build without DEBUG = True, however, the server refuses to load any external file.
For example, our main .js file yields the following error:
Refused to execute script from 'http://localhost:8000/static/static/js/main.5b32b158.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
(Yes, that file path is correct.)
The content-type response header is always “text/html”.
Manually adding “type” declarations to the <script>
tags does not resolve the issue.
We get the same error even just trying to load images with an <img>
tag.
We have the following:
ALLOWED_HOSTS = [‘localhost’, ‘127.0.0.1’]
Is there some setting we need to enable serving of external files?
Many thanks in advance!