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",


"^(/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.

1 Answer 1


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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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