Archive for the 'web development' Category

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!

Django Nicities

I’ve been working on a project using Django for the last couple days and am falling in love with it. There are so many nice features that make the life of the developer much more enjoyable. The nicest thing is the automatic administration panel. For many projects it’s enough to define a model and activate the admin panel. Another nice feature that I just discovered is the automatic api documentation for you project. If you click on the ‘documentation’ link at the top right of the admin panel, the documentation is presented in a very well organized and attractive manner. You’ll need docutils installed for this. Whenever an error occurs in you code and you set ‘DEBUG’ to ‘True’ in settings.py, you get a really clean error report. Generic Views saves you a huge amount of coding.

I’m still trying to get my head around everything, but so far everything has been going quite well. I would like to have a way to automatically choose the current user in the Admin panel and some of the included apps (comments, for example) need to be documented. Most aspects of the framework have quite nice documentation, though.

Ok, back to the project.

Setting Up Django on Dreamhost

Jeff Croft has a nice tutorial on how to set up Django, a python web framework, on Dreamhost.

If you want to use the sweetness that is Python to do web development, are a Dreamhost customer and would like to be able to avoid this in the future, I propose that you vote to have it included as a standard feature. Go to Home > Suggestions in the Admin Panel, search for Django and then cast your vote. This is how Ruby on Rails got included.

While you’re at it, cast a vote for Postgresql, Django’s preferred database and a vote for mod_python.

read more | digg story