views:

237

answers:

1

I'm a beginner with Pylons and I've mostly developed on my localhost using the built-in web server. I think it's time to start deployment for my personal blog, I have a Debian Lenny server with apache2-mpm-prefork module and mod_wsgi - I've never really used mod_wsgi or fastcgi and I hear either of these are the way to go.

My questions:

  1. Should I go with mod_wsgi or fastcgi and why?
  2. Where should I be creating my web application? Should I create an entirely new user for it? Should I store it in /home/meder/web-app ? I currently have some php websites being hosted on my server and they live in /www/ which is a directory I created. Is there any sorta gotcha with static binary files such as images, as there is with django?
+2  A: 
  1. mod_wsgi. It's more efficient. FastCGI can be troublesome to setup, whereas I've never known anyone to have a problem using mod_wsgi with a supported version of Python (2.5, 2.6, 3.1 included). WSGI exists for Python (by Python, &c.) and so it makes for a more "Pythonic" experience. Prior to WSGI I used to serve small Pylons apps via paste behind mod_proxy (due to massive issues with fastcgi).

  2. Anywhere is fine, any user is fine. If you're worried about security, you may wish to add another user. You could create a home folder in /www/ if you were so inclined :) Static binary files, images, etc., should be served separately if you can, but Pylons had (actually, I believe still does have) a method of serving these (this should be the 'public' folder). I would still use a separate mount as Apache is more efficient at serving these than passing them through Pylons.

Swixel
Ok, +1 more for `mod_wsgi` so it looks like I won't be using FastCGI. Have you ever used `nginx`? Seems some people are using that and `reverse-proxy`, though I'm not sure what the benefit of the combo is.
meder
For some reasons why nginx in front of Apache/mod_wsgi can help, see comments in 'http://serverfault.com/questions/81663/nginx-varnish-nginx-django/81680#81680'.
Graham Dumpleton
Graham's link explains a few reasons.nginx and I got off on the wrong foot in its early days, so I've never really returned to it. I believe the short answer (as I hear it, and as Graham's post affirms) is that you can cache/compress for multiple requests. There are, of course, other ways to do it, but this one is fairly well tried and tested. Basically you save yourself some otherwise 'wasted' power.
Swixel