Mar 28, 2012

Login URLs in Django

Django is a pain.

I know - its a great framework. Its also supposed to be robust and highly recommended by a few friends when I asked around for what should I use as I wanted to learn how to develop a website.

I have been dilly-dallying with making the website for quite some time, but now I am trying to put in a few hrs every week into it. I enjoy it so far... but then I run into some stupid roadblock.

Today I ran into another one. If I do not document it, I am sure that I will make the same mistakes again.

Today's problem was with the login redirect URL.

I have a function with the decorator as follows :

@login_required
def foo(request, template_name="foo.html"):
    return render_to_response(template_name,locals(),context_instance=RequestContext(request))

I changed the default account redirect to /account so my urls.py has the following:
    (r'^account/', include('account.urls')),

Now, when I tried to click on the link which requires the login ( and I am not logged in) I got the following error :

The current URL, accounts/login/, didn't match any of these.

See the s in accounts. I tried searching everywhere where I had the accounts word. grep did not turn up anything and I was quite frustrated.

Finally, I reasoned that it has to be something with the way django does anything and started reading the settings documentation. Sure enough, @login_required requires a url which defaults to /accounts/login !

Why the Django documentation has to be so vague with login is something I don't understand.

So, I added the following lines in the settings.py :
LOGIN_URL='/account/login/'

Not it works !

Gah !

Mar 23, 2012

Lvl 25 Indian Guild in World of Warcraft

This is good news !



Most of my readers would know that I play World of Warcraft. Well, I used to - till a few months back when work became overwhelming to really put in enough time in the game.

When I had started playing Wow in 2006, I was always looking for people from India. I found people from far away places like Brazil but no Indians. Then I started a google group and got a few people in it.

At the end of 2010 I started a guild with the people there after a particularly bad day in office. I named it 'Vinash'. We got the guild to a good start with Indian people joining in. Unfortunately we had a couple of real bad eggs who wanted to run the guild and I was not really Guild Leader material. Sad to say that guild disintegrated.

Enter Sumantho who rolled a new Guild. Since I was on the google group and the facebook group I got excited about it and joined it. The guild got more and more people. It was originally rolled on the horde side on Skullcrusher, called Astra, and I rolled a Paladin figuring that I would make a Tank, and levelled him to 85. Turned out, I made a lousy tank :D

Sometime in between, people decided to move to servers in Oceania as the ones in US , due to the distance of the continents , were not giving good latency numbers. Another factor was that on SK we were just not enough people and getting random people to PUG with us was not happening. So different servers were being checked out for people availability and AH prices. Also, the main people were kinda wanting to go Alliance ( me too ). We had some late night calls over this and ultimately a decision was taken to move to Frostmourne and do a faction change. The guild was named Yuva. I moved my Shaman over to the server and being a healer was gearing it up till work and life caught up. After a month of hardly playing I had to sadly stop playing.

But I continued trolling the facebook group.

Then yesterday it got posted that the guild had levelled up to 25 (the max level as of now in WoW). Felt good. Kudos to the team - Brats, Purva, Bobby, and all the others. GG.

Mar 15, 2012

Redmine Ubuntu Installation Error

One of the most amazing software tools that I have found which meet almost all my needs in the day to day working is Redmine (hard to convince people in the office though). However I ran into a problem recently which seems to be quite prevalent going by the searches thrown up.

Cannot start Ruby on Rails application
The directory "/usr/share" does not appear to be a valid Ruby on Rails application root.

Mar 5, 2012

Earthquake Delhi

Delhi had a tremor in Sep last week and had another one today. People got something to gossip and tweet about. 

Today's earthquake measured 5.2 on the Richter Scale and lasted a few seconds but was enough to get people to run out of their offices. For my part, I did not even feel it and was oblivious to it until I got asked by someone. Thats when I got to know about the quake and checked out the news channels - including facebook and twitter. 

This was a small quake. 

I am scared if a big quake came. 

For comparison, the Latur Earthquake in 1993 was 6.2 , and the more recent Haiti earthquake was 7. 

Delhi falls in Zone IV. If , Delhi was to ever get a high intensity earthquake which lasted more than a few seconds, the city is going to see massive destruction. Most of the city is made up of shanties with no proper planning going into making of houses. People point at Old Delhi and say it will collapse, I think most of the modern Delhi will also collapse. 

The picture I see in my mind is quite grim.
  • Most of the water piping is old piping. It does not need an earthquake to break those pipes and every few months we see news reports of a broken pipe flooding a road in some part of Delhi. These will all happen on the same day. The basic necessity of life will not be available. 
  • Electricity will be the other big hit. People in many parts of the city steal electricity by hooking the overhead lines. Just raise your head above the streetline in any congested locality and you can see the messy mesh of wires. Sparking will cause massive blackouts and fires in most parts of the city. 
  • Houses constructed dont follow the guidelines laid down for earthquake safety. In Many places you have a large area of slums. These will all collapse.
At all this, there is hardly any disaster plan in place. Delhi had a mock earthquake drill a few weeks back - but that assumes that people in Delhi will help out the people in Delhi. There is no plan for getting aid from other parts of the country into Delhi. 

All in all, if this becomes a reality - we are in Deep Shit.