From 851c85f4be4ddb275af03224e22c71f8b65e33e6 Mon Sep 17 00:00:00 2001 From: Sebastian Lohff Date: Tue, 17 Mar 2020 23:08:35 +0100 Subject: [PATCH] Add piston install documentation --- README.piston | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 README.piston diff --git a/README.piston b/README.piston new file mode 100644 index 0000000..6ef6cba --- /dev/null +++ b/README.piston @@ -0,0 +1,22 @@ +Django piston is pretty old and does not work with django1.11 out of the box. +For the transition these are the changes required to get piston working + +Start out by creating a new virtualenv, install the requirements, then change the following lines: + +In piston/emitters.py: + # instead of the original simplejson import + import json as simplejson + + # instead of the DateTimeAwareJsonEncoder import + from django.core.serializers.json import DjangoJSONEncoder as DateTimeAwareJSONEncoder + + # in ~186 replace the following line + for f in data._meta.fields + data._meta.virtual_fields]) + # with this line + for f in data._meta.fields + tuple(data._meta.virtual_fields)]) + +In piston/resource.py + # in ~207 replace + resp = HttpResponse(stream, mimetype=ct, status=status_code) + # with this line + resp = HttpResponse(stream, content_type=ct, status=status_code)