

Dagny: Rails-style Resource-Oriented Architecture for Django - zacharyvoase
http://github.com/zacharyvoase/dagny

======
tworats
Comparisons to django-piston and motivation for creating this library would be
helpful.

~~~
zacharyvoase
FYI: I’m working on a pretty full suite of documentation at the moment, since
the README has become a bit overloaded.

The motivation for creating this library was pretty simple: I really like the
Rails way of modeling the application around resources, and then ’mounting’
those resources at URLs with the absolute minimum necessary amount of code.
This resource-oriented approach is key in building truly ‘RESTful’ web
services.

I wanted a simple but powerful content negotiation mechanism, which
effectively gave me a comprehensive ‘API’ with zero additional effort. I think
I’ve achieved that here; for example, adding JSON output support to a specific
action is usually a 3-line affair, or you could very easily write a generic
renderer and enable it for _all_ actions across your entire site.

Finally, even though the Rails inspiration was so strong, I needed to keep
Dagny as consistent as possible with the practices and idioms of the Python
and Django communities. Again, I think I’ve done pretty well in that regard.

In response to your other question, I think Piston is a great library—however,
I think the idea that you have to define an API _separately_ from the rest of
your site is just the wrong way to do things. I’m also not a big fan of
Piston’s architecture and resulting API; it’s not as polished as I’d like it
to be (although that’s more of a cosmetic issue).

~~~
numix
Did you check out Tastypie (<http://toastdriven.github.com/django-tastypie/>)?
It is also RESTful, and explores some similar ideas as a replacement for
Piston, but approaches it in a manner similar to Django models.

~~~
zacharyvoase
It’s quite a nice solution actually, but I’m afraid it’s far too coupled with
the Django models for many of my use cases. A lot of the time you’ll create a
Resource without any model to back it—for example, most Rails projects use a
UserSession resource for logging in/out, with logging in => new/create, and
logging out => edit/destroy.

------
zacharyvoase
Dagny now has some proper HTML reference documentation:
<http://zacharyvoase.github.com/dagny/>

The tutorial is very much a WIP though.

