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.
One of the easiest solutions to setup that performs considerably well in my opinion is
nginx
along withgunicorn
.For ''gunicorn'', you only need to do something like:
And a pretty standard nginx setup for this is
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.Considering your lack of experience and its magnificent management GUI, I recommend Cherokee. A fast, easy to use web server with a built-in wizard for configuring a Django project.
Use Apache and disable the modules you don't need and ensure that you're not spawning too many processes to begin with.
The idea that Apache's core is somehow heavyweight is somewhat of a myth - it can be as beefy or lightweight as you need it to be, thanks to the modular design.
This has the added benefit of working with your existing distribution packaging and update system.
PS: The OS will happily swap out unused pages to disk when the applications are running but the webserver's admin interface is not being accessed. Trust the OS to keep resident what it needs, when it needs it.
PPS: A 2GB DIMM costs less than your time spent typing this inquiry. Take some time to do some meta-analysis of your question.
The non plus ultra solution , in my eyes, is nginx+uwsgi (it's a bit more difficult to set up, because you have to compile it on your own and config more). The easiest and recommended is Apache+mod_wsgi. I think a well configured Apache2 with mod_wsgi is the right choice for you.
Django (Python) + webserver? Then maybe have a look at Tornado too (though it can handle far more than you want).