Django as an Alternative

After real­ly look­ing back and forth regard­ing WordPress and Drupal I decid­ed to look around at dif­fer­ent devel­op­ment frame­works just for gig­gles and ran into Django (pro­nounced jan­go) again. I have run across Django before and usu­al­ly elim­i­nat­ed it imme­di­ate­ly because it is Python based instead of PHP. But for what ever sil­ly rea­son… uhm, yeah, PHP using the back­slash (\) for name­spaces… instead of throw­ing Django out, I took a look at it, just to remind me why I didn’t like Python.

I can sum up my gen­er­al dis­com­fort with Python in one word, “spaces.” Python uses indents as its pri­ma­ry struc­ture and high­ly relies on/recommends spaces instead of tabs for those indents. I find myself always mess­ing stuff up when I use spaces instead of tabs, one too many, one too few. Oh, not when I first write the code, the text edi­tor does take care of that but when I come back to the code and start mak­ing mod­i­fi­ca­tions. spaces always mess­es me up.

And those spaces are impor­tant since Python uses indents instead of braces for orga­ni­za­tion… let me give an exam­ple of tra­di­tion­al code which will look ugly because I will do what it lets me do first then the same thing in python:

if(true) { do this; do that; } else { do the other thing; }

if true:
    do this
    do that
    do the other thing

Now some would say the python way is “clean­er,” eas­i­er to read. Well, I could have made the first exam­ple with mul­ti­ple lines, indents and orga­nized it very sim­i­lar to Python, and I always do so it would look almost exact­ly the same except for the braces ({}).  Python how­ev­er enforces that type of struc­ture of mul­ti­ple lines and indents unlike say PHP which relies on the braces to know what it is doing so you can write ugly code as in the exam­ple. I like the com­fort of the braces for the struc­ture, it real­ly empha­sizes what is what. But real­ly, once you get used to writ­ing in in a par­tic­u­lar lan­guage, it feels nat­ur­al and even­tu­al­ly even “the right way.” So Python could even­tu­al­ly feel as com­fort­able as PHP. But using those darn spaces instead of tabs will always get me.

So, Python hasn’t become the stum­bling block that it might have been in the past. I have been play­ing a lot with Django. There is a lot to like about it, some things I am not sure about, but in an odd way, it may become the thing for which I have been look­ing… at least for more com­plex web devel­op­ment. It works well with PostgreSQL as well as oth­er DBs. It makes doing data­base stuff easy… you can almost for­get SQL except maybe for real com­plex queries. It has a bunch of pre-made apps… yeah, the ter­mi­nol­o­gy gets a bit “dif­fer­ent” at times… but Django is real­ly designed to help a devel­op­er quick­ly devel­op cus­tom apps to flesh out a par­tic­u­lar web­site.

In Django, you start with a “project” which in my mind equals the dynam­ic part of the web­site. Static stuff like images, css, etc may actu­al­ly be served out­side of the project, even from a dif­fer­ent web serv­er. Each project then has mul­ti­ple apps. Each app has a spe­cif­ic pur­pose with­in the project/website.

Who knows where this will even­tu­al­ly lead but I am find­ing myself lik­ing Django a lot because I sud­den­ly feel like the straight jack­et is a lot less con­strain­ing… or maybe the padded cell is a lot larg­er. I am sure as I work with it more, there will be things I won’t like and who knows, even­tu­al­ly I could end up back work­ing with Drupal after all (WordPress will prob­a­bly always be some­where in my tool­box). But for now, it has my atten­tion and I am hav­ing fun play­ing with it.

Leave a Reply