Sep 25

Last week, I signed up an account with Webfaction, for my latest Django (sounds like Jungle) adventure. So far, it's one of the few web hosting companies out there that offer support for Django framework and they did a superb job at it. I love them.

A few days back, I wrote my first Django app, Tweeeter, after following a few tutorials. With the app, I think it will be great to get it deployed to have a full experience from programming to deployment. So I followed the tutorial from Webfaction's knowledgebase.

However, I felt the approach has messed up the normal structure that I usually used, which is having apps folder and includes folder in the django project folder. The tutorial shows how to server static files by creating Webfaction's app. So if you have 10 static folders, you will have to create 10 Webfaction's app, which I can't understand why I must do it. So, after hours of trying, with the help of Webfaction's support, it finally works the way I wanted.

So how do I setup my own django app in Webfaction?

I followed exactly what the tutorial said except the part of setting up the static files. Instead of creating multiple apps, I just add the following to the apache/httpd.conf in the djangoproject.

Alias /includes/ /home/username/webapps/webfactionapp/djangoproject/includes/
 
    SetHandler None
Alias /media/ /home/username/webapps/webfactionapp/lib/python2.5/django/contrib/admin/media/
 
    SetHandler None

I hope it's clear enough. If there is any questions, feel free leave it in the comments.

written by mangoorange \\ tags:


4 Responses to “Sexy way of setting Django in Webfaction”

  1. 1. David Sissitka Says:

    Using your Django app’s instance of Apache to server static content isn’t a good idea, it’ll kill performance your website’s performance. Your best bet is to put all of your static content in a single directory and create symlink app which points to it.

    Hope it helps. :)

  2. 2. InViN Says:

    Yo bro, what new project have you been working on? sounds interesting. How’s Python compared with PHP in terms of performance?

  3. 3. Says:

    @David Sissitka: How do you create a symlink when the URL is controlled by the Django instance?

  4. 4. Says:

    @InViN: for that i’m not exactly sure, but i sure love the framework.