(It is also a whole lot of black magic compared to front-end optimization. See any of the presentations by the YSlow guys -- google [high performance web sites] and look for the slides or videos. They give simple, tested, repeatable "do this and it will work" best practices. Backend optimization, on the other hand, relies far too much on handwavy lore and near-useless-or-actually-harmful micro-optimizations. For example, "StringBuffers are sooooooo much faster than String concatenation!")
I second that. My experience is first look into the DB time and second browser rendering. I have thought Python was the cause for slowness many times and each time it again proved to be DB time. Also, don't run multiple selects to the database for a set of records, make it one select.