My next thing: Django + [Insert Here]

Published 2011-06-16 on Farid Zakaria's Blog

I’ve decided to give a bit of rest to my relentless onslaught of projects towards Hype Machine (somewhat at the request/annoyance of Anthony Volodkin). As always, I like to pick projects where I have completely almost zero experience with and use it as a good chance to learn something new and possibly have fun.

As much as it pains me to start to admit it, I think web development is slightly growing on me. It’s kind of funny however that although I’ve been hacking together Javascript for the past little while, I still don’t at all completely understand the syntax and how it works. I should probably do something start, and go buy a book and read up on it… I’ve decided then to continue in my exploration of the interwebz through creation of a Django project.

Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.

I have yet to figure out what I would like to do with the Django application I’d like to develop. Thoughts that I were tossing around were perhaps working with an additional site/SDK such as Facebook’s, Soundcloud’s etc… to try and deliver some neat functionality. If you have any suggestions, throw them my way.

My choice to use Django was pretty easy. I love python and hate ruby.


Deploying Django

For some crazy reason, I decided to learn how to deploy Django on my shared hosted server Bluehost.com first before actually learning Django (don’t get me started on my annoyance with using a shared server now).

I have my main domain address ‘www.fzakaria.com’ pointed to my Wordpress blog. I wanted to achieve in having Django installed as a sub directory/url of the domain (rather than a subdomain). i.e. ‘www.fzakaria.com/django/

There was plenty of resources available (shockingly even on the Bluehost FAQ) which helped me setup the server appropriately however I ran into a lot of GOTCHAS just because I didn’t know what I was doing.

  1. Python doesn’t recursively search through the PYTHONPATH if the directory is created as a module. (i.e. needs an __init__.py file in the directory). This caused a headache and me having to add a lot of additions to the PYTHONPATH before I realized it.
  2. Each directory under your public_html folder should have it’s own .htaccess file. I mistakingly was trying to couple the .htaccess file for the main domain which handled my Wordpress blog and the one that would start the fcgi script to launch Django.
  3. Deploying to your server should really be the last step of creating a Django application, especially on a shared server. Since it’s a shared server I haven’t figured out a way to cause Django to refresh the server when I make modifications to any of the MVC python files for my application.