Python web frameworks

Lately I played around with python web frameworks. After working on a web project with Django last year, I discovered Aspen lately. There are many other frameworks out there. Nevertheless, I’d like to share my findings about Django and Aspen. 🙂

  • Both use python, which is generally known as being fast. It’s compiled and therefore usually less memory hungry than other web oriented languages. There are also better ways to optimize performance, e.g. by writing a custom web server, if your website has high traffic.
  • Both frameworks are nicely object oriented. You get a request object (Django, Aspen) which encapsulate all information from the client. The application can use all its information to generate the output, encapsulated in a response object (Django, Aspen). When errors occur, you can simply raise an error response object in the middle of your code.
  • Aspen and Django are providing templating engines which are very similar to each other.
  • URL’s like http://falstaff.agner.ch/list/10/ score in terms of readability and alterability. Also, they simply look better! Both frameworks encourage the user to use such URL’s without file endings or unreadable long query strings (like ?page=start&session=123). While Django uses a configuration file, Aspen uses the file system itself to create such URL’s.

However, there are also big differences between these frameworks…

  • Biggest difference: Aspen doesn’t have a built-in model layer/object-relational mapper. You have to use a 3rd party model layer (such as SQLAlchemy), write your own model layer or use one of the new “No-SQL” databases. Django has an object-relational mapper included and provide a nice admin interface for all your models.
  • Aspen combines both page logic and view (HTML) in one file, called simplate. Nevertheless, logic and view is separated by a page break character.
  • Django has many classes to handle forms. There’s an authentication system. There’s a caching mechanism. In short, Django has a lot built-in solutions for common problems. Aspen, on the other hand, is small but nice.

As usual, there is no winner. Which one to choose is up to the actual project and personal preferences. I’ve created a small project with Aspen, ACDR. ACDR is a web interface for Asterisk Call Detail Records. It’s meant for small offices to get log information like who called when, with option to call them back quickly. You can take a closer look here.

Leave a Comment