Django from the trenches

August 21, 2009...... at 9:12 am | Posted in geek | Leave a comment

I walked into the office this morning to an email from one of my colleagues asking me for my opinion on Shabda’s article A response to Dropping Django. The article makes some interesting points and re-affirms my opinion of Shabda as a top-notch python developer. However, I also feel for the points made by Brandon Bloom as they mirror some of my own experiences.

In 2006 I sat down with 2 web developers that had never written a line of python code and together in 7 months we wrote a syndicated Javascript application using django as the application layer. I don’t think we could have done this without the help that django provided. It provided a really great architectural platform upon which to base an introduction to python web applications. To people new to the world of python web applications, its been my experience that django is the least intimidating.

In 2007 I sat down with 2 of the best python developers I am ever likely to work with and over the space of two weeks hashed out a development platform. They were firm TurboGears enthusiasts but I already had working Django code in my repository. What we came up with as an acceptable compromise was Genshi templating (sandboxed), FormEncode validation, TurboGears views and SQLAlchemy ORM. Fourteen months later we launched a kick-ass web application.

In 2009 I sat down with a web developer who had never written a line of python and guess what? I chose Django. Three months later we released JobCrystal. Top flight developers, probably shouldn’t be using any framework other than the one they’ve been involved in rolling themselves, because anybody’s else’s framework is going to itch. For the rest of us mere mortals who aren’t interested in solving authentication again, or url dispatching again, or caching again – Django makes some really sensible choices that in my experience allow you focus on the real issue of delighting your customers a lot quicker than would otherwise be the case. Once you’ve got delighted customers, sure you can go back and re-engineer the parts that don’t feel quite right (I’m dying to play with Django’s contenttypes capabilities to get a higher level of abstraction), but for most web applications the focus has to be on getting to market as quickly as possible and Django provides more of that than any other framework I know.

Advertisements

Getting Skype sound working in Jaunty

June 28, 2009...... at 1:39 pm | Posted in geek | Leave a comment

In Skype -> Sound Options choose pulse for all. Then open up the Ubuntu volume control (Next to the data in the top right corner) and choose the Alsa Mixer. Then click the preferences button find all the microphone options and display them. Unmute and play with the volume setting on each device until you find the one that gives you nice clear sound. Make a Skype Test Call to check that everythin is working.

Pydev unresolved import errors

June 12, 2009...... at 3:21 pm | Posted in geek | 37 Comments

For those seeing a lot of Pydev unresolved import errors the problem is related to the fact that pydev doesn’t seem to register nested modules. So if your package contains a package which contains a module, unless the parents of both packages appears on the Pythonpath, pydev will hit you with an unresolved import error. To make it go away you have 2 choices:
1. Add the parent to the python path
2. Click Ctl + 1 and select Unresolved import error

Model Inheritance and AttributeError in Django base.py

June 11, 2009...... at 12:23 pm | Posted in geek | Leave a comment

Spent 2 hours last night debugging an inability to create an instance of a particular model because of an attribute error. The problem turned out to be that I had a read-only attribute on the child, fullname = property(_get_full_name), which had the same name as a field on the parent model. Another interesting discovery was that you don’t seem to be able to override fields using inheritance. Define a field called location on the on the parent as a charfield and define a field called location on the child as a foreignkey. If you define a modelForm on the child you get a charfield rather than a select field. So basically always ensure that there are no common field names between your parent and child models it’ll save you hours 🙂

django-compress easy_install gotcha

June 10, 2009...... at 2:45 pm | Posted in geek | Leave a comment

If you choose to install django-compress using easy_install then remember to add the -Z switch.
If you install the egg as a zip file the tags don’t work.

Postgresql not running on Jaunty

June 5, 2009...... at 12:53 pm | Posted in geek | 4 Comments

If like me you upgraded your ubuntu Jaunty and then found that postgresql.conf had disappeared and /etc/init.d/postgresql start failed silently. The magic command that you need to run is (drumroll):
sudo pg_createcluster 8.3 data

followed by:

sudo pg_ctlcluster 8.3 data start

then carry on with createuser and createdb just as per usual.

Getting your VirtualBox VM visible on your LAN

April 23, 2009...... at 1:09 pm | Posted in geek | Leave a comment

One of the developers here at JobCrystal is a windows refugee so rather than throw him in the deep end, we’ve put him on a windows box and put ubuntu in a virtualbox vm. Today’s challenge was making the VM visible on the LAN. Turns out the trick is to bridge the VirtualBox Host-only lan adapter and one of your NICs on the host. In windows select the two network connections you want to bridge and right-click and select bridge.

Then in the network settings of the VM, select Host-only network adapter. We also had issues with the fact that we are using a non standard gateway and everytime we turned on bridging one of our PCs would loose its DNS nameservers, but thats another story.

Firefox toolbar customisation issues

April 22, 2009...... at 2:16 pm | Posted in geek | Leave a comment

If like me you suddenly find that all the extra buttons installed by extensions like NoScript, Feedly, SessionManager, ScribeFire or AdblockPlus suddenly disappear from your Firefox toolbar, then I have good news. Through a process of elimination I tracked the problem down to TabMixPlus, and since this is the one extension I am unable to live without I emailed Gary to ask if he had come across this issue before. He replied within an hour and told me to disable the Ubuntu Firefox Modifications extension, which fixed the problem.

For the record this problem only manifested on Intrepid, I have not had any issues with Firefox on Hardy.

ppp0 not replacing existing default route

April 5, 2009...... at 6:19 pm | Posted in geek | 1 Comment

If your modem is telling you that it is not replacing the default route and as a result your internet only works if you disconnect from the LAN then what you need to do is add the following two lines to the options file:

sudo nano /etc/ppp/options

defaultroute
replacedefaultroute

Ctl-x,Y

This will cause the pppd to send all non lan traffic to the ppp0 interface rather than the eth0 interface.

route -n will list your routes

Encrypted Joikuspot Nokia Ubuntu wireless hotspot howto

April 4, 2009...... at 8:43 pm | Posted in geek | 2 Comments

I love my N82. Not only does it take great photo’s, give me directions to places I don’t know and tell me how fast I ran, it also provides a temporary wireless hotspot in my office so we are not without air internet while we wait for Telkom to flick a switch.

XP seems to have no problem connecting to the adhoc wireless network that Joikuspot provides but the network manager in Ubuntu was having none of it. So here’s how to connect to an adhoc wireless network in Ubuntu:

  1. sudo apt-get install madwifi-tools
  2. in your JoikuSpot settings, set channel to 6, encryption to WEP Open, key type to Hex, key length to 128
  3. disable wireless networking in Network manager
  4. sudo wlanconfig ath0 destroy
  5. sudo wlanconfig ath0 create wlandev wifi0 wlanmode adhoc
  6. sudo iwconfig ath0 mode ad-hoc channel 6 key 85895cb353be3321c3f1248e9a essid JoikuSpot_0 #key = Joikuspot key
  7. start your JoikuSpot
  8. sudo dhclient ath0
  9. surfs-up for all PCs with a wifi card
  10. sudo dhclient ath0 -r  #to release IP
Next Page »

Blog at WordPress.com.
Entries and comments feeds.