Forums

Static files (javscript and css) not loading: "was blocked due to MIME type (“text/html”) mismatch"

Hello, my webapp doesn't recognize the javascript and the css file.

The resource from https://robertpecz.pythonanywhere.com/blog/static/css/color.css” was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff).
The resource from https://robertpecz.pythonanywhere.com/blog/static/js/theme-toggle.js” was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff).
Loading module from https://robertpecz.pythonanywhere.com/blog/static/js/index-bundle.js” was blocked because of a disallowed MIME type (“text/html”).

and

Loading failed for the <script> with source https://robertpecz.pythonanywhere.com/blog/static/js/theme-toggle.js”.
Loading failed for the module with source https://robertpecz.pythonanywhere.com/blog/static/js/index-bundle.js”.

I found this forum and help page but the issue still persist. Could someone help me figuring out what is wrong. Obviously in local everything is working fine.

You are not serving the static files, so you're getting 404 error pages in html and that is why your browser is rejecting the resource. See https://help.pythonanywhere.com/pages/DebuggingStaticFiles/