Saturday, July 16, 2005

Django knows. First impressions.

I mentioned that I'd been playing around with Zope/Plone (for the last month I haven't had time to due to workplace absentism (not mine)). Well, that might change with Django.

Before using Zope, I had been checking out other Python frameworks and templating systems. CherryPy, Woven, Nevow, Cheetah, HTMLTemplate, Twisted, Myghty, PyMeld, Clearsilver... You name it, I tried it.

For my first project, developed from the ground up, I used Pymeld (templating) and SQLObject (object-relational mapping). This was a small project and I only worked on it during a fortnight.

The latest project requires something more. It requires user authentication, access levels, etc... I started working on it with Plone and most of the 2 weeks I have spent on it so far has been reading up on Zope/Plone and the implementation ideology.

My main problem with Python and the current web frameworks is that they suck. It's a big call but they all feel very cumbersome and all encompassing. They seem to disregard everything out there and the reasons why PHP has become so popular. The main reason why PHP is so popular is that they are by in large designed for commodity web hosting providers.

Most Python frameworks don't even run in CGI mode and require installation. They assume that you host the web site and administer the web server. How is a Python project meant to gain popularity and a critical mass when common people can't install it?

Well, I don't have that problem because I'm developing for work on a standalone Linux box. Still, I hate bloated frameworks. Why can't the minimum requirements just be Python, Apache (and MySQL)? And for good measure, optionally support mod_python for killer speed (most commodity web hosting don't and won't support mod_python or mod_php because of security implications)?

Django looks to be on the right track.

What are Django's prerequisites?

Django requires Python 2.3 or later, Apache2, and mod_python. You'll also need a database engine; PostgreSQL is recommended, and MySQL is supported.

We're currently working on expanding those options: WSGI support is in the works (which will allow Django to run under CGI, FCGI, etc.), as is support for a number of other database backends.


They are also using Trac (although Trac uses the Clearsilver template system which requires a binary compile. I do like Clearsilver though) which gives me more confidence.

As a background, Django powers the sites created by World Online. There is a good talk here about those web sites.

5 comments:

Anonymous said...

Are you sure you really tried Myghty ? Myghty supports mod_python, CGI, and WSGI right now. its extremely lightweight, very high performing, can run from a home directory quite easily, and while its not a front-end + database solution by itself, the view paradigm is far more mature and widely used than Django's since its a basically more featured version of HTML::Mason...and for ORM, SQLObject works quite well and similarly beats out Django's quick-and-dirty approach hands down. Whereas Django was written for a specific project and then "cleaned up" for the outside world, Myghty was written from day one to be the most flexible and stable Python solution for the largest possible audience.

Julian said...

Anonymous:

Thanks for the comment.

When I said "they suck", I wasn't speaking about the templating frameworks I've tried but the web frameworks.

Yes, I like Myghty too. I haven't used it extensively though. I was strongly considering it (tested it and read the docs) but made the jump to Zope/Plone.

For ORM, SQLObject isn't bad. I've used it quickly but it could be better and doesn't look like it's actively developed. Yet to check out Django's ORM implementation.

Anonymous said...

Regarding Django's ORM, the mysql support was tossed in literally 2 weeks ago. Django currently somehow has gotten a nice fat dose of hype for who knows what reason. Having a pretty CRUD is not the end-all of frameworks, at least Rails deserved a lot of the hype it got.

It actually encourages crappy development by mixing logic with presentation, and even mixing presentation code with your data model. At least Rails enforces a consistent MVC separation.

Regarding Myghty, there appears to be some documents on the site about running it under Fast CGI. Since Rails apps run under Fast CGI, using that should let you use your Myghty (Or any Python Paste framework) with any hosting provider that supports Rails. Assuming you can get them to install a few Python libs. :)

Ian Bicking said...

SQLObject is definitely actively developed. Well, somewhat actively -- it's very actively used, it's gotten past the point in its developed where it is maintained purely by one person (and it is true my involvement has waxed and waned from time to time). So even at times when I wasn't actively developing it, other people were adding features, and the mailing list remained a useful resource. It's gone through some significant changes over the years, but I think has done so quite successfully.

Julian said...

Ian:

Thanks for the clarification. I also just read your latest post yesterday and checked out the improved SQLObject web site.
I guess I wasn't sure about the dev status because I hadn't seen any News on the SQLObject site since 26/Jan/2005.
Yeah, I also checked out the latest SVN repository and took a look just then.
Keep up the work with SQLObject, Paste, etc...