see whatever…

jump to menu

December 17, 2007

Django…

Filed under: Web,XSLT — see @ 11:22 pm

Noticing the the Django book is final I began reading it today (I wanted to look into Django for some time now but never really came to it). Anyway the book is quite nice, easy reading with simple examples (a bit too targeted to beginners which I guess I am not really anymore).

To try the examples I downloaded the newest Django release (0.96.1 I think), untared it and started setup.py. Funny enough this simple step failed… After looking into the source of setup.py I noticed this line: package = dirpath[len_root_dir:].lstrip('/').replace('/', '.'). Being on Windows this of course failed and I changed it to ‘\\’. I guess one should use os.path.sep in this case so I decided to add a proper bug report to the Django Trac. Again this simple idea failed as my short post was not allowed as the system thought of it as spam :(

So I gave up on this. Two simple things failing does demotivate me…

But I started reading the book anyway and tried the examples too (after the hacked install ;) ). Until Chapter 4 where I am currently it all makes sense (should do with Djangos good reputation). I am not quite sure if another templating system was needed though. I still prefer XSLT for templating as it gives me total freedom about the HTML and if the source XML is based on XHTML it is not even difficult to write or understand. A few well-placed added elements (in another namespace) do all what I want in theses cases (e.g. a menu renderer). Anyway Djangos templating and its philosophical background seem to make sense but look like JATS in the end.

As a side note, I use web.py at work for a small project at the moment. It works very well and XSLT usage was very simple to add. I guess Django is better for more complex apps but web.py is fine for simple stuff. Documentation is lacking though and I don’t think there will be any “web.pybook” soon ;)

Another side note: Another project at work uses Wicket (Java Framework) which is not too nice for/to web developers, too difficult to really control HTML and Javascript. I do not have to do the backend here so that’s ok but still web.py and also Django look much much nicer and easier (no surprise really but anyway…).

2 Comments »

  1. you say not to nice for/to web developers? thats odd all the web designers i know love it because they can do exactly what they are good at. Designing html pages, but what javascript/html do you want to control use??

    Comment by Johan Compagner — December 18, 2007 @ 2:21 pm

  2. As a frontend developer I like to control any part of the HTML “completely” and it seemed that wicket made some parts not too easy. Also the separation between Java and HTML is not complete. Please don’t take my “complaints” too serious though…

    But to give some examples:

    1. Adding a CSS-class to an existing

    BTW, something like “addCSSClass”/”removeCSSClass” would be a very helpful part of any web frameworks’ API I guess (maybe wicket has something like this but we have not found it yet).

    2. Having an HTML

    with some fields in it (this might have been a wicket component, but I cannot say for sure as I mainly was doing the HTML parts) and say I want a (wicket) link in it. There is a difference if that link is inside or outside the form so the problem is that I cannot simply move the link without changing the java code too. Hope this is at least halfway clear…

    Another ceveat: I know that the project we used Wicket for was the developers’ first Wicket project and so they will not know any shortcut or the whole API.

    Anyway, using XSLT for templating gives me (almost) total control as I only get the data and hardly any suggestion how it should be in HTML (depends on the XML of course and there still are certain dependencies but much less than in wicket or in fact in most other templating engines).

    This was no bashing on Wicket (AFAIK one of the better Java web frameworks, maybe a bad example :) but e.g. compared to JSF).

    I guess any templating system has limits but from a HTML perspective I definitely prefer XSLT to most other templating systems (BTW, also Django’s).

    I guess I did not make a very clear point with this comment. But I definitely do not want to start a flame war about web frameworks, I am simply not competent enough (I know maybe 10 out of 10000 ;) ) Still this is an ongoing issue in our company (and I guess in others too) and is not a very easy decision which framework to use. Being a Python person makes it easy to prefer frameworks in a higher level language (than Java) like Django or Rails or even XSLT (if viewed as a templating language only). BTW, there was a very nice presentation (slides plus video) with a comparison of JSF, Struts 2, Wicket, Tapestry and some more here: http://parleys.com/display/PARLEYS/Comparing+Java+Web+Frameworks?showComments=true

    Comment by see — December 18, 2007 @ 9:11 pm

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress