3 ms·
Thanks for posting this. I use Django extensively and I never really felt any pain from the tightly coupled monolithic approach, but I always like improving my
by yesimahuman 14y ago
Thanks for posting this. I use Django extensively and I never really felt any pain from the tightly coupled monolithic approach, but I always like improving my tools. I will check out Flask.
Any suggestions for making it easy to build REST style APIs? Is piston the #1 choice still?
- mumphster 14y agoCheck out Tastypie. You can get a full restful API based around your models up in like 5 lines of code and it's really easy to add extra functionality. Sorry for the lack of a link I'm posting this from a phone
- papercruncher 14y agoYes, still the #1 choice in my books, especially if your APIs do not match your models 1:1. Tastypie is cute but gets in your way a little too often for my liking. Django-rest is another contender but I haven't tried that yet
- philfreo 14y agohttp://pydanny.com/choosing-an-api-framework-for-django.html http://pydanny.com/choosing-an-api-framework-for-django.html
- bdr 14y agoI prefer tastypie. It takes a fair bit of time investment to learn how it does things, but once you do it's powerful.
- jtchang 14y agoI've used all 3 and I settled on "django rest framework". http://django-rest-framework.org/ http://django-rest-framework.org/ The issue I have with piston is that it didn't turn my objects into JSON automatically for me when I returned from the call. I also had to map each and every call (GET/PUT/POST/DELETE) and there was no default out of box behavior. I felt like I was violating the DRY principle over and over. Tastypie was great when I started but I wanted to do some non-RESTful things with it. Like POSTing to /article/{id}/{action}. Yes it is not REST...I don't care. It makes a lot of sense to POST to /article/15/publish to publish an article. I had to override so much inside tastypie it was getting to me. Django restframework is a bit different. Default behavior is centered around mixins (basically multiple inheritance). I created a mixin for actions being specified and basically added it to any resource I wanted to have that. If you want to know more feel free to ask.
- Daniel_Newby 14y ago> The issue I have with piston is that it didn't turn my objects into JSON automatically for me when I returned from the call. That sounds like the perfect place to use a Python function decorator, which lets you wrap a funtion in standard boilerplate.