﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
32041	Document Windows caveats in mimetypes warning.	Peter Marheine	Peter Marheine	"When using `manage.py runserver` for development on Windows, I've had issues with some static files being served with incorrect MIME types- particularly javascript files were being served with content type `text/plain`, for which most browsers will emit a warning and if the file is being loaded as a javascript module they will refuse to execute it (which is troublesome for development as you might expect).

In Django this happens in `django.views.static.serve`, which delegates to Python's `mimetypes` module to guess the MIME type of a file by name. On Windows `mimetypes` gets configuration from the registry, such as the key `HKEY_CLASSES_ROOT\.js\Content Type` (if it exists) for .js files.

Where this becomes problematic and I think it may be appropriate for Django to do something about it is that it's very easy for users to have incorrect MIME type settings in the Windows registry. I found that it was set to `text/plain` on this machine, which appears to have been set by either Visual Studio or VS Code and this sort of problem also seems to affect Go in the same way (https://github.com/golang/go/issues/32350) as well as being somewhat common among Django users (https://stackoverflow.com/q/16303098/2658436).

I also found (by inspecting the registry in a clean Windows sandbox) that Windows doesn't seem to ship with a MIME for .js specifically, so arguably this is just a problem with Windows in that it's easy to misconfigure. It's unclear to me what a good solution to this might look like, since if a user wanted to configure a weird MIME type for some file then the registry would be the place to do it, but Django can't tell the difference between a weird configuration that a user specifically configured and one that ended up that way accidentally. It may be most appropriate to document this particular pitfall and not make any code changes.

#6484 is a very old ticket that's related- this might be considered a point showing there is demand for packaging MIME type definitions to use on Windows."	Cleanup/optimization	closed	Documentation	dev	Normal	fixed			Ready for checkin	1	0	0	0	0	0
