Web-server – Lightweight web server for Django with small workloads

djangolightweightweb-server

I'm writing a small app in Django that will be used as admin interface for a set of applications usually configured by text files. It won't do much (parse user input, convert db entries into flat files and display pretty tables with info) and most likely will be used at most by one user at a time.

Only constraint is that the server it will be run on is low-specced (Pentium M 1,8GHz, 512MB RAM) and I want most of its computing power available for managed apps and not management interface. For the record, I'm using CentOS 5.

What webserver can I use? So far, I gathered following options and opinions:

  • Apache may be to big for this kind of deployment
  • lighttpd + FCGI – may be unstable
  • lighttpd/nginx as rev proxy + django web server – looks strange to me, as I've thought that django web server is meant for development/debugging purposes

Can you recommend me a good solution for this kind of environment? I'm not focused on big workloads or concurrency (as most people asking similar questions are), I just want it to use as little RAM and CPU time as possible when idle or for single sessions.

Additionally, please note, that I don't have much experience in deployments of web servers, reverse proxies etc. (although I know the basics and can find my way around with google), so I would really appreciate help from people who have experience with this kind of problems.

Best Answer

One of the easiest solutions to setup that performs considerably well in my opinion is nginx along with gunicorn.

For ''gunicorn'', you only need to do something like:

$ cd path/to/yourdjangoproject
$ gunicorn_django --workers=4

And a pretty standard nginx setup for this is

server {
    ...

    location / {
        proxy_pass http://127.0.0.1:8000;
        break;
    }
}

Certainly better than using fcgi and depending on flup but if you don't mind getting your hand's dirty I'd suggest that you try nginx+uwsgi as zaub3r3r suggested.

Related Topic