Archive for July, 2006

Top 30 Django Tutorials and Articles

As a response to the Top 30 Ruby on Rails Tutorials, I’ve compiled a list of the top 30 Django tutorials and articles. These links are in addition to the great documentation on the Django project site.

For those who don’t know, Django is a Python web development framework that makes development super fast.

The list in no particular order…

  1. Are you generic?
  2. Sending E-Mails via Templates
  3. Django admin for your PHP app?
  4. Hacking FreeComment
  5. the difference between ‘blank’ and ‘null’
  6. Using Django’s TemplateTags
  7. A Django website that took (a lot) more than 20 minutes
  8. Forms With Multiple Inline Objects
  9. Extending Generic Views
  10. Template context processors
  11. Custom SQL In Django
  12. How Django processes a request
  13. Write better template tags
  14. Extending the User model
  15. Django’s Undocumented contenttype app
  16. Django, gzip and WSGI
  17. Django for non-programmers
  18. Django Templates: The Power of Inheritance
  19. Django Templates: An Introduction
  20. Setting up Django on Dreamhost
  21. Django on Windows HOWTO
  22. Django Admin Hack - Fields varying with user permissions
  23. Some django gotchas
  24. Django Templates are not limited
  25. Develop for the Web with Django and Python
  26. An AJAX ComboBox Widget for Django
  27. Using Django’s Free Comments
  28. MochiKit and Django
  29. RSS made stupidly simple
  30. Installing Django on OSX

Note: keep an eye out at Django’s community page for new tutorials and articles.

Related Links

If you have an additional tutorial, put it in the comments.

digg story

Setting Up Tomcat 5 on Ubuntu 6.06

I had mentioned that I’d post a quick how-to on setting up Tomcat 5 on Ubuntu Dapper. So here it is and lucky for me it’s VERY easy.

Translations: castellano

First a quick overview of what we are going to do:

1. install software
2. change 1 line in a configuration file.
3. start the Tomcat5 service
4. go to http://localhost:8180

And now for the good stuff.

First we want to install the right packages. basically we want to install apache2, a java jdk and tomcat (duh). I’ve chosen to use Sun’s java implementation. To install this you need to enable the multiverse repository. See this section of the Unofficial Ubuntu Starter Guide for help with enabling additional repositories. To install Tomcat itself you will also need to have the universe repository enabled.

Note: For Tomcat you MUST have a jdk not just a jre.

So, for the basic install use the following command.

sudo apt-get install apache2 tomcat5 sun-java5-jdk

If you want a shiny Tomcat welcome page when we finally get that far then install the example apps by adding tomcat5-webapps to the end of the last command. For the Tomcat admin web interface add tomcat5-admin, too.

My final command looks like this.

sudo apt-get install apache2 tomcat5 sun-java5-jdk tomcat5-webapps tomcat5-admin

By default Ubuntu uses a free Java implementation. We now need to tell Ubuntu that we want to use Sun Java as the default. Run the following command.

sudo update-alternatives --config java

Then enter the number of the version of Java you want from the list when prompted. The one I wanted was /usr/lib/jvm/java-1.5.0-sun/jre/bin/java.

Now we need to tell Tomcat where the jdk is. Open /etc/default/tomcat5 and change the variable JAVA_HOME to read…

JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun/

Make sure it’s NOT got a “#” at the start of the line. You can should now be able to start Tomcat5 with…

sudo /etc/init.d/tomcat5 start

Tomcat is listening on port 8180. So open up firefox and enter http://localhost:8180 in the address bar. Once the page loads you should see either a tomcat welcome page or, if you chose not to install the examples and admin packages, a fairly empty page with “Apache Tomcat/5.0″ at the bottom left. Congrats, you just installed a working Tomcat service. If you don’t see one of these pages, either you or I screwed up. ;)

If you installed them, the example apps can be found in “/usr/share/tomcat5/webapps/“. Also take a look at the configuration files in “/etc/tomcat5/“.

Hope that was helpful.

Update: Manolo Canga added a section in his Spanish translation of this tutorial that I’ve translated into English below.

Setting up an admin user

If you try to use the admin interface you’ll find you can’t because no admin user has been set up. To resolve that go into /var/lib/tomcat5/conf and edit tomcat-users.xml. You’ll see that 3 users have been created by default. We’re going to change the password of the user “tomcat” (<user username="tomcat" ) to something better than the default of “tomcat”. Duh!? Now we are going to give the user “tomcat” admin access. Add “admin” to the user tag’s roles attribute. It should look smilar to this.

<user username="tomcat" password="your_password" roles="tomcat,admin"/>

Now restart tomcat…

sudo /etc/init.d/tomcat5 restart

…and you’re done!

Fulfilling promises and moving out

So last week I completed migrating Sprachenatelier Berlin e.V. to Ubuntu 6.06 (codename Dapper). Everything is working quite well and they are pretty happy with it. They definitely have noticed a difference for the better over Ubuntu 5.04 which they had been running. The Nautilus changes (path buttons, places, etc.), the Ubuntu updater (only for the admin of course), Tomboy are among the things they’ve mentioned. One thing that needs to be changed is the location of the shut down/logout button. It’s way to easy to inadvertently click on it when trying to close an application.

One of the pc’s has instability problems. It crashes (actually freeze) about twice a day. I’ve tried all available kernels and 3 different (vesa, radeon, fglrx) xorg drivers both with and without dri enabled. I can get it to crash each time by running OpenOffice’s document format converter on a large (~1000) number of files. I’m next going to try the 2.6.15-21 kernel once I find it. Switching to the 21 revision fixed my wife’s Thinkpad T21 which was having the same problem.

In other news…

On Monday I got finished with 90 percent of going through my stuff before the move; deciding what to take/keep, ebay, or take to the flee market. This was made very easy this time since when I did my “real” move last July I sorted everything quite thoroughly. It’s so nice to know exactly where I’m going to stay and be doing once in San Diego. Last time I flew in without any connections, rented a car, went through craigslist on my laptop while outside of a house with wireless and after about 21 hours and only one night sleeping in the rental car I had an almost perfect, for me, place to stay with really nice folks.

Less than 2 weeks before I go now. Yeah!

Advertise Your Frustration

This guy has found a really nice way to vent his frustration at seeing obtrusive ads everywhere you freakin’ look.

Sleep Deprivation and Being a Loser

On Sunday I installed Ubuntu 6.06 (Dapper) at Sprachenatelier Berlin e.V. a small language school in Friedrichshain. It took all night and I’m still not finished. Someone had installed a Tomcat server that was serving a custom jsp app. Having never installed tomcat nor having ever developed Java Server Pages and only finding out about it when I arrived I didn’t have enough time to do all the other thngs plus learn about tomcat and install jsp apps. So I installed Ubuntu on the 4 “student” computers and left the 2 office computers for some time in the next couple days. On Monday in the comfort of my own home I learned about Tomcat and I had everything running in an hour or so. I also wasted a good amount of time ridding the single duel-boot Windows install of viruses and spyware.

I’ll do an Ubuntu 6.06/Tomcat install how-to soon. No, really… I promise. :)

On Tuesday Annika and I packed a picnic and went to the Fan Mile to watch the Germany vs. Italy match. Of course, Everyone knows the outcome of that. I was so looking forward to the penalty shoot-out. Oh well. May Italy suffer a humiliating defeat in the finals. They are such whiners; falling at the slightest touch. I’m hoping Portugal wins it all now.