Sunday, March 29, 2009

Django Installed, Pyjamas Not...

The Django Story
So I got Django 1.0 installed. That was very easy. Thanks to the team for making that happen so easily. No need to say much else - just follow the instructions. Verification is very easy by loading up python2.6 and typing "import django" to make sure everything is setup right.

The Pyjamas Story
So I haven't talked about Pyjamas yet, but I decided to go with it as the UI platform/Library as GWT looks very usable for what we're looking to do. Plus our UI designers liked to use the GWT demos for the site design. So I tried to install Pyjamas by going to pyjs.org and downloading the package. I can't get it to work just yet... But here are my notes so far:

  • Download setuptools before downloading pyjamas. You need it to install it, no way around it - so go ahead and get it. Make sure you download the right one for your python version... In my case 2.6.
Unfortunately I wasn't able to validate it the same way I was able to verify Django's setup. I'm pretty sure it doesn't work at all just yet. Gotta go back and try again tomorrow night... I'll let you know what I find (hopefully soon)

Saturday, March 28, 2009

Setting up a Django Server for Dev/Hosting I

As previously stated, I'm way out of touch and struggling to do things that most consider obvious. But the journey's the fun part anyway (I keep telling myself). These "Setting up a Django Server for Dev/Hosting" posts are going to be answers to questions I have about getting the environment ready for dev and hosting. (Since we're 4 months from release).

Assumption #1. CentOS is the server OS
Going to release on CentOS 5.2 Why? It's free and considered "server" and very stable and well tested. I dont want to take chances with OS issues, so I love "Mr. Stability". Problem is, I found that an idiot like me can take down the whole server where it requires a complete re-install within 10 minutes...

Assumption #2. I want the terminal Python release for my Django Projects
Why do I want terminal releases? In my 15 years of development experience, terminal releases are usually rock solid (at least compared to the other releases). So I'm going with Python 2.6.1 for my websites. But... CentOS 5.2 comes with Python 2.4...

Answer/Lesson. Well just install 2.6.1 on CentOS 5!
Duh! That was easy and probably obvious. But... "Don't do it". Well, "Do it, but be really careful". So in updating CentOS 5, it's very simple to just download the Python 2.6 source and compile it as the instructions say and then install it as the system python binary. The problem is when I rebooted the system wouldn't get past the GRUB loader. I think it never even shut down correctly as it failed to run some python scripts with the 2.6 binary.

UGH! I had setup a lot of stuff (Eclipse, PyDEV, etc...) and now I had to reinstall the OS from scratch (I tried to just install on top but this failed permanently too). After I got my blood pressure back down from it's peak, I tried again - downloaded python 2.6, compiled it, and installed it. BUT - this time I was careful to change the link to python in /usr/bin to python2.4 instead of python2.6 (found in usr/local/bin). So the easiest way to verify this is to run python as root and as your user and make sure that it always runs as version 2.4.3. I then ran python2.6 and made sure it always ran as version 2.6.1. Seemed ok so I rebooted.... Everything came back fine this time. WHEW!

Lessons Learned.
  1. Don't replace system script libraries with new versions without REALLY knowing what you're doing. (I even saw some websites warn me, I just didn't see how it would break anything!)
  2. Verify your installs work properly after you've done them. Check things as root and as a user (originally I had different behaviors in the two cases).
  3. Linux is incredibly easy to break badly. Tread carefully, change as little as possible.




Getting Started Again...

Ok. Time to get started.

Now leaving my job - so now it's time to get serious. I last did web development back in 1995 (I know, how sad is that). So it's time to re-train. Fortunately I've had enough time to try to get re-acquainted with the modern world. Lots of choices, lots of technology, lots of interesting stuff to waste time on.

So we're making a consumer-oriented web service to engage a population that isn't being well served today. Lots of frameworks to pick from: Rails, Java, Django, PHP, etc... Gotta review them quickly and pick one. Went with Django - primarily because it seems pretty straightforward/simple, it appears to scale well, but also because years ago I did enough Python to feel good about using it.

So Django it is... But that's just the first question. What about UI frameworks? What about databases? Answers to come later I guess.