Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm planning to migrate an old website to django. Initially, I want to use django for the urls www.mydomain.com/news, and continue to use the old static website for everything else.

I have little experience of lighttpd, which my django host uses, so I need some help with the configuration.

For a default django install, the lighttpd configuration is:

# mydomain
$HTTP["host"] =~ "(^|\.)mydomain.com$" {
    fastcgi.server = (
        "/django.fcgi" => (
            "main" => (
                "socket" => env.HOME + "/projectname/projectname.sock",
                "check-local" => "disable",
            )
        ),
    )
    alias.url = (
        "/media" => env.HOME + "/projectname/media",
    )

    url.rewrite-once = (
        "^(/media.*)$" => "$1",
        "^(/.*)$" => "/django.fcgi$1",
    )
}

I've changed the line

"^(/.*)$" => "/django.fcgi$1",

to

"^(/news/.*)$" => "/django.fcgi$1",

so that django is only used for urls beginning /news/, but I don't know how to redirect everything else to the static website folder.

share|improve this question
add comment

1 Answer

up vote 4 down vote accepted

server.document-root = env.HOME + "/projectname/static" should do the trick. On a side note: Your rewrite pattern:

 "^(/news/.*)$" => "/django.fcgi$1",

should probably been written as:

"^/news/(.*)$" => "/django.fcgi$1",

That way the "/news/" part of the url doesn't get passed on to the django.

share|improve this answer
    
Thanks, that did the trick. –  Alasdair Sep 3 '09 at 17:29
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.