Henrique Bucher
Henrique Bucher

Reputation: 4474

How to setup django with lighttpd?

I have a live website that is running under lighttpd. I now have a sub-domain that I want to run under django. I do not want to move to Apache as I don't currently have the resources to support two production web servers. The django part is actually working well with the django builtin development server so now I just need to port it into production.

It seems that all documentation to setup django with lighttpd is over 10 years old and uses fastcgi that from what I can see was deprecated and removed from django. The new docs point to use wscgi - scgi under lighttpd. But even that is being hard to get any documentation.

Do I need to run uwsgi and use that to serve the pages to mod_scgi? Or should I use gunicorn? I am sort of at a loss on what to do.

Suggestions welcome!

Upvotes: 0

Views: 403

Answers (1)

gstrauss
gstrauss

Reputation: 2404

lighttpd supports uwsgi with mod_scgi and scgi.protocol = "uwsgi"

scgi.protocol = "uwsgi"
scgi.server = ( "/" =>
    (
        (
            "socket" => "/tmp/scgi.sock",
            "check-local" => "disable",
            "fix-root-scriptname" => "enable"
        )
    )
)

Using mod_scgi and the uwsgi protocol to communicate with the Django server will likely be faster and use fewer resources than using gunicorn (and communicating using lighttpd mod_proxy)

How to use Django with uWSGI

The uWSGI docs linked there recommend configuring the web server to serve static files rather than sending those requests to Django.

Upvotes: 1

Related Questions