I have been trying to make a website using python (flask) as the backend with javascript on the client side. It genrealy works, but the problem is when i start it on my main PC i get the following error: "Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/plain". Strict MIME type checking is enforced for module scripts per HTML spec.". When i start the same project on my laptop it works flawlessly.
At first i thought it might be because i was using two diffrent Python versions (3.11 and 3.9) but after trying both on both machines, it still worked on the laptop but not the PC.
Here is the python code running the server:
import json
import os
from Server.Accounts.accountManagement import loadAccount
from flask import Flask, send_from_directory
app = Flask(__name__)
app.debug = True
app._staic_folder = os.path.abspath("files/static/")
@app.route('/')
def serve_files():
return send_from_directory('files', "homepage.html")
@app.route("/profile")
def profile():
data = loadAccount.getAccount("Ignitz")
data = json.dumps(data, indent=4)
return data
if __name__ == '__main__':
app.run(host="localhost", port=3000, debug=True)