Some Django tips and tricks pages that I’ve found helpful.

My current work involves working on some Web applications developed using Django. Although I’ve used Python much in the past, my experience with Django was quite limited. So I recently did some research to become more proficient with it, and will list below some of the Web pages that I found provided the most useful tips and tricks for when using Django.

  • Some Django tips: Although an older article, it also makes some good non-Django suggestions, like installing IPython and ensuring your project has a test suite.
  • Small Django tips from one newbie to another: Another older article, this one also emphasizes the need for unit testing, and gives some examples (with code) about how to go about this. It also discusses ways to manage frequent model changes during development.
  • Usefull tips to start a new project with Django: A slightly dated article that summarizes how to get started with Django, and well as some suggestions for when deploying a production Django application.
  • Django Tips: UTF-8, ASCII Encoding Errors, Urllib2, and MySQL: Gives useful tips about handling UTF-8 encoded strings. Although the project I’m working on thankfully didn’t make the mistake of using MySQL, this article does include some tips relating to string encoding and MySQL, which may be useful for some people.
  • Big list of Django tips (and some python tips too): This offers perhaps the greatest quantity of Django tips in a single page. It’s quite complete, covering areas such as deployment, configuration, templating and views, the model, testing, and so forth.
  • Tips for Scaling a Web App: While not completely Django-specific, it lists some good ideas for how to develop a database-backed Web application that scales well.
  • Django Tips: PIL, ImageField and Unit Tests: Gives some time-saving suggestions about using the Python Imaging Library with Django and unit tests.
  • Django Image Uploading: Tips and Tricks: Outlines how to upload images in Django apps, with some suggestions about how to solve some common problems.
  • 10 Insanely Useful Django Tips: I think the title of this article overhypes it somewhat. The tips are useful, but they are somewhat common-sense tips, as well. Although I haven’t tried it yet, this article did point me to django-debug-toolbar, which sounds like it might be useful.
  • ‘Practical’ tips for working with Django: Includes some suggestions regarding developing custom managers, wrapping generic views, and converting text to HTML before rendering the template.
  • Debugging Django: One of the more detailed articles I found suggesting some strategies for debugging Django applications.
  • Django development tips: Some ideas for setting up a long-running Django development server in a UNIX-like environment using GNU Screen. More advanced users of UNIX-like systems are probably familiar with this technique, but this article is still a useful reference and tutorial for newer users.
  • Django Tips – Unique Date Querysets: A quick suggestion about how to get all of the unique years and months for a data set such as the posts in a blog, or other timestamped data.
  • Favorite Django Tips & Features: This thread from Stack Overflow contains a variety of user-contributed tips. Some of them suggest software to use in conjunction with Django, including Jinja2.
  • Tips to keep your Django/mod_python memory usage down: Some deployment and configuration suggestions to reduce Django’s memory usage when using Apache and mod_python.
  • Django Doctest Tips: Some tips for testing Django applications using doctest. Suggests better ways to locate failures, to use conditionals, to check context variables, and to check content type relations.
  • djangotips on Twitter: I didn’t find the quality of these user-contributed tips as good as those from Stack Overflow or the other pages, but there were a few that seemed like they might be useful.
  • Django Tips, Vol. 1: Contains five tips covering topics like the difference between ‘blank’ and ‘null’, displaying multiple fields on the same line in the admin, and so on.
  • Django cheat sheet: Although this is a cheat sheet, and not really a Web page, this is one of the cleaner cheat sheets that I’ve seen. I’ve found it to be a useful reference so far.
  • Django performance tips: This article is also older, but many of its suggestions are very sensible and apply even when not using Django, such as using separate database and Web servers if possible, using PostgreSQL, and putting as much RAM as possible into the servers.

Of course, those are just a small sample of the many useful Django resources out there. But for those new to Django, reading through the articles about may help avoid some common pitfalls, as well as offer ideas to help become more productive while getting accustomed to Django.

Leave a Reply