Django Aware

Home | »

Installing Django on Gentoo The Hard Way

By Paul Kenjora | April 2, 2007

For those of you who have not used VMWare please do. It will change the way you do development. On one PC I have several distinct development environments all linked flawlesly together via source control. I can load up a VM (Gentoo) play around with a configuration, then burn the whole system if I dont like it. The best part is that Gentoo has so much rich documentation and is so well desinged and configured that I rarely have trouble getting anything I want. But I stray from the topic back to Django…

So Django was something I was very reluctant to try at first, but I figured Python is so rich and powerfull that even if Django sucks I get some benefits. As it turns out Django sucks only if you try to fight it. The guys who Designed it are those really smart types who didn’t need to study for tests and figured no one needs to read documentation. So they created a pretty good framework (once you backwards engineer it) and some pretty horrible documentation. Luckily they were smart enough to allow users to “blog” their instructions.

Finally to bring it all together and set up Django on Gentoo:

  1. Download the tar from the official page: http://www.djangoproject.com/download/
  2. tar xzvf Django-0.95.tar.gz
  3. cd Django-0.95
  4. sudo python setup.py install

The sudo command will probably not work so here is what you do:

  1. Create the path: /usr/django/lib/python
  2. Create the file: /etc/env.d/99django
  3. Add: PYTHONPATH=”/usr/django/lib/python”
  4. Run: env-update
  5. Run: source /etc/profile
  6. python setup.py install –home=/usr/django

To summarize what happened above is pretty quick. The “sudo” utility automatically sets a few things up for you if its missing you need to do them manually. First you created all the directories Django will need for Python. Then you added to Gentoo’s environamental configuration files, the setup is based on files that are read at startup to assemble all env variables. In steps 4 and 5 you updated the environment files used by the system and then all current processes. Finally in the last step you did the install manually with “sudo” hence you had to specify the install path.

And then lots of lines will scroll by and your installation will be complete, you can move on to the Django tutorial.

To test and make sure everything went ok try the following:

  1. Type: python [enter]
  2. You should see something like “>>>”.
  3. Type: import django [enter]
  4. If no errors come up life is good.
  5. Topics: Environment Setup | Comments

    blog comments powered by Disqus