Django escape Piracy Inc

Piracy Inc

A few years and five houses ago, I had an idea. It was to be an online game, browser based, where you would own and run a racing car company. There’d be research and development, and aliens, and stuff, and every Saturday night, you and the people in your league would be able to watch in real time as the races happened.

I started it in PHP, badly. I used it as a reason to learn Django a few months later, then converted it to Code Igniter when I was about to start at Doof and needed to learn it in a hurry. Then I changed it to be about Pirates instead of race cars, because I’m not actually very interested in race cars. Then I rewrote it in Plank, which was a PHP framework library I still think should exist. Then again in Rails because frameworks are hard and Ruby seemed useful, then finally in Django again because I actually like Django.

By the PHP version it had bits of the game defined, by the Ruby version it had ships and missions and such, and by the Django version there are actual bits of the universe to go and attack (though you can’t actually attack them yet).

Updates on how its going appear on its own weblog every so often, and between that, LARP, Soulbook and Languagelab, that’s what I’m doing with my time.

Cantrip Django Imported From Epistula

Djingle Django Scarecrow

One of the concepts you may run into if you read into Python and its fans in great depth (and here I mean Python of the programming type rather than the Monty type) is that of “Guido’s Time Machine”, the number of times when you are thinking “Would it be nice if Python did this…” and you suddenly find that yes, that’s exactly how Python does it, to the point where the only way Guido could have possibly considered all this would be if he already knew.

I’m having the same kind of thing with Django. Frameworks for validation, existing user system, that kind of thing. Stuff like “Do you know what would be nice? If I could do something so that my Logged in User’s Profile appeared in the default scope of a template, so I didn’t have to pass it in every time, and keep throwing it around the program.” and suddenly, there are Context Processors.

The annoying bits are where stuff is under development, or half documented. For example, Having spent a while creating a User Profile system to associate information specific to this system (Authentication code, invite code, email me alerts, for example) and joined it one-to-one with the user system, I then find a tiny little bit of text in the User Auth system docs which says:

get_profile() -- Returns a site-specific profile for this user. Raises django.contrib.auth.models.SiteProfileNotAvailable if the current site doesn't allow profiles.

This sound really close to what I’ve spend a while doing myself, but that is the first, last and only reference to it in the docs that I can find.

OTOH, I’ve now got a system you can log into and register for, and I’ve got a deeper understanding of how Django works. Yay.