Python ORMs Supporting POPOs and Substituting Layers in Django

Travis Parks jehugaleahsa at gmail.com
Sat Nov 12 11:11:21 EST 2011


On Nov 8, 12:09 am, Lie Ryan <lie.1... at gmail.com> wrote:
> On 11/08/2011 01:21 PM, Travis Parks wrote:
>
>
>
>
>
> > On Nov 7, 12:44 pm, John Gordon<gor... at panix.com>  wrote:
> >> In<j98tnf$qh... at reader1.panix.com>  John Gordon<gor... at panix.com>  writes:
>
> >>> In<415d875d-bc6d-4e69-bcf8-39754b450... at n18g2000vbv.googlegroups.com>  Travis Parks<jehugalea... at gmail.com>  writes:
> >>>> Which web frameworks have people here used and which have they found
> >>>> to be: scalable, RAD compatible, performant, stable and/or providing
> >>>> good community support? I am really trying to get as much feedback as
> >>> I've used Django and it seems to be a very nice framework.  However I've
> >>> only done one project so I haven't delved too deeply.
>
> >> You are probably looking for more detail than "It's a nice framework" :-)
>
> >> The database model in Django is powerful; it allows you to do queries in
> >> native Python code without delving into backend SQL stuff.
>
> >> I don't know how scalable/performant the database model is, as the one
> >> project I worked on didn't deal with a ton of data.  (But I'd be surprised
> >> if it had poor performance.)
>
> >> The URL dispatcher provides a very nice and logical way to associate a
> >> given URL with a given method call.
>
> >> Community support is excellent.
>
> >> --
> >> John Gordon                   A is for Amy, who fell down the stairs
> >> gor... at panix.com              B is for Basil, assaulted by bears
> >>                                  -- Edward Gorey, "The Gashlycrumb Tinies"
>
> > I started the battle today. The "new guy" was trying to sell me on
> > CodeIgnitor. I haven't looked at it, but it is PHP, so I really want
> > to avoid it. The good thing is that all of his "friends" have been
> > telling him to get into Python. I have been trying to convince him
> > that PHP isn't cut out for background services and is mostly a front-
> > end language. Python is much more geared towards hardcore data
> > processing. Why write the system in two languages?
>
> > I have been spending a lot of time looking at the Pyramid project: the
> > next generation of the Pylons project. It looks powerful, but it seems
> > to be a lot more complex than Django.
>
> CodeIgniter is a very fine framework, however it builds on top of a
> shitty excuse of a language called PHP.
>
> I've found that Django has a much better debugging tools; when a Django
> page produces an exception, it would always produce a useful error page.
> I haven't been able to do the same in CodeIgniter (nor in any PHP
> framework I've used, I'm starting to think it's a language limitation);
> often when you have errors, PHP would just silently return empty or
> partial pages even with all the debugging flags on.
>
> IMO, Python has a much nicer choice of built-in data structure for data
> processing. Python has a much more mature object-orientation, e.g. I
> prefer writing l.append(x) rather than array_push(l, x). I think these
> qualities are what makes you think Python is much, much more suitable
> for data processing than PHP; and I wholesomely agree.
>
> Database abstraction-wise, Django's ORM wins hands down against
> CodeIgniter's ActiveRecord. CodeIgniter's ActiveRecord is basically just
> a thin wrapper that abstracts the perks of various database engine.
> Django's ORM is a full blown ORM, it handles foreign key relationships
> in OO way. The only disadvantage of Django's ORM is that since it's
> written in Python, if you need to write a program working on the same
> database that doesn't use Django nor Python, then you'll have a problem
> since you'll have to duplicate the foreign key relationships.
>
> With all the bashing of PHP, PHP do have a few advantages. PHP and
> CodeIgniter is much easier to set up and running than Django; and the
> ability to create a .php file and have it running without having to
> write the routing file is sometimes a bliss. And PHP are often used as
> their own templating language; in contrast with Django which uses a
> separate templating language. Having a full blown language as your
> templating language can be a double-edged sword, but it is useful
> nevertheless for experimental work.
>
> IMO, while it is easier to get up and running in PHP, in the long run
> Python is much better in almost any other aspects.- Hide quoted text -
>
> - Show quoted text -

The good thing is that I got the new guy to convert his thinking
towards Python. He did a little research of his own and realized what
he was missing.

He and I have been writing some tools in Python, accessing social
networking sites, and have been pleasantly surprised by Python's rich
support for web protocols. Even yesterday, I wrote some code using
xmlrpclib and it blew the equivalent C# code out of the water. urllib2
and urlparse make it really easy to work against RESTful services. It
seems like most of Google's APIs have a Python variant.

We are thinking we will go along with Pyramid, rather than Django. It
was a really hard decision to make. Django has a lot of community
support and is integrated with PyDev in eclipse. Nonetheless, we are
anticipating the need for massive through-put on our web servers, so
we want to make sure we don't have to change gears 2 years down the
road when we have 100,000+ users. Furthermore, it seems like Django
doesn't allow for customization - we might want to switch between ORMs
and the template engine.

It is going to be an interesting process of moving from an ASP.NET MVC
application to 100% Python. We'll see how well we can scaffold them
together.



More information about the Python-list mailing list