-
-
Notifications
You must be signed in to change notification settings - Fork 16.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
static content mime-type always text/plain #1045
Comments
Flask does not do this on a clean install with everything setup properly so without access to the code it will be very hard to actually work out what you are doing wrong. |
So here's the code layout.html - http://pastebin.com/p0tERJtW This is bugging me like nothing has ever did. |
Can you run this and tell me what the output is: import mimetypes
print(mimetypes.guess_type('style.css')) |
|
In chrome can you load http://localhost:5000/static/css/style.css?test (assuming that is the correct URL) and change the 'test' to a random string. In the network tab of dev tools can you print screen the headers tab for the request. |
in if filename is not None:
if not os.path.isabs(filename):
filename = os.path.join(current_app.root_path, filename)
if mimetype is None and (filename or attachment_filename):
mimetype = mimetypes.guess_type(filename or attachment_filename)[0]
if mimetype is None:
mimetype = 'application/octet-stream' can you add a |
I still get |
I somehow misread this comment. The python mimetypes module pulls the values from the registry on windows so somehow your registry has got a bit messed up. If you open regedit and go to the |
My registry is indeed broken. Found |
Sounds like a good time to change editors ;) |
I work with ST3. That was a test to see whether NuSphere community went dead or not 'coz they just seem to be increasing the version number with hardly any new feature. That evaluation version screwed two days of my life. |
@praveenpuglia Can you close the issue :) |
You can also fix this with:
This may be preferable because it doesn't rely on system configuration. |
I had the same issue with JS files 😂 Found out that windows registry had |
And here , it was VisualStudio ;) |
python-eel#49 python-eel#181 it seems like these issues weren't ever truly fixed. It would be nice if Eel set the mimetypes on its own. According to pallets/flask#1045 this bug will happen for all Windows users. The most common use for this would be to import JS modules. Chrome doesn't allow modules with incorrect mimetypes to be loaded without a registry edit. mimetypes is a Python standard lib so there shouldn't be much impact. Cheers!
#49 #181 it seems like these issues weren't ever truly fixed. It would be nice if Eel set the mimetypes on its own. According to pallets/flask#1045 this bug will happen for all Windows users. The most common use for this would be to import JS modules. Chrome doesn't allow modules with incorrect mimetypes to be loaded without a registry edit. mimetypes is a Python standard lib so there shouldn't be much impact. Cheers!
i had the similar problem with .js files. |
I have this weird problem. I am trying to include css files from the static directory, the browser downloads the content of the CSS file but it says the server is sending the css with
mime-type:text/plain
It's best explained here - http://stackoverflow.com/questions/23452967/jinja2-static-files-mime-type-always-text-plain. I am unable to include any CSS file.
The text was updated successfully, but these errors were encountered: