After 6 months using Django, I’m still not entirely comfortable with it’s separation between applications and projects. Apart from how to name the first application (“main”? “web”? “site”?), I frequently find myself wondering whether a particular piece of functionality does not warrant it’s own application.
So far, my rule of thumb has always been “only if it’s reusable in other projects” – basically, stuff like a forum, blog or wiki. As I’m about to start writing an API for critify, the issue comes up again. Create an “api” app? According to the above, the answer would be no, but I am hesitating. It would make sense, in a way. New models will be necessary. Doesn’t an api_keys table seem more “right” then one called site_apikeys?
Maybe a better rule would be: “if it needs it’s own models”.
General consensus in the Django community is beginning to move towards having as much as possible in applications and avoiding projects unless you really have to use them. Relevant links:
http://www.pointy-stick.com/blog/2007/11/09/django-tip-developing-without-projects/
http://www.b-list.org/weblog/2007/nov/09/projects/
LikeLike
Simon,
thanks for your comment. I had actually read both those posts, and I know that a “project” is really not much more than a settings file. My confusion has more to do with how to split functionality to across multiple applications – or not to.
In the end, there’s probably not an easy answer. I hope that over time I’ll be able to better rely on my intuition.
LikeLike