mime-types

Correct MIME Type for css.map files

Correct MIME Type for css.map files Question: looking for a bit of help that will most likely help other devs. When serving files that are extension .css.map what should their MIME type be? This problem arose for me when serving files from s3 and in the upload process using boto3, one must set the MIME …

Total answers: 2

Preferred (or most common) file extension for a Python pickle

Preferred (or most common) file extension for a Python pickle Question: At times, I’ve seen .pickle, .pck, .pcl, and .db for files that contain Python pickles, but I am unsure what is the most common or best practice. I know that the latter three extensions are also used for other things. The related question is: …

Total answers: 1

CSS not loading wrong MIME type Django

CSS not loading wrong MIME type Django Question: I have installed virtualenv in my localhost to run a django app with 1.8 version but when running it the css and js files doesn’t load. I get Resource interpreted as Stylesheet but transferred with MIME type application/x-css I have tried some options but they don’t solve …

Total answers: 10

Flask request and application/json content type

Flask request and application/json content type Question: I have a flask app with the following view: @menus.route(‘/’, methods=[“PUT”, “POST”]) def new(): return jsonify(request.json) However, this only works if the request’s content type is set to application/json, otherwise the dict request.json is None. I know that request.data has the request body as a string, but I …

Total answers: 2

Forcing application/json MIME type in a view (Flask)

Forcing application/json MIME type in a view (Flask) Question: I can’t figure out how to force the MIME type application/json for a view in Flask. Here is a simple view I’ve thrown together for demonstration purposes: @app.route(“/”) def testView(): ret = ‘{“data”: “JSON string example”}’ return ret The JSON string (held in variable ret) is …

Total answers: 2

What's the difference of ContentType and MimeType

What's the difference between ContentType and MimeType? Question: As far as I know, they are absolute equal. However, browsing some django docs, I’ve found this piece of code: HttpResponse.__init__(content=”, mimetype=None, status=200, content_type=’text/html’) which surprise me the two getting along each other. The official docs was able to solve the issue in a practical manner: content_type …

Total answers: 4