Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to wrap my head around Pylons and how it works. So far... it's been confusing... I'm using EC2 with Fedora8. Everything is working so far (i.e. I have Pylons/python et al installed and after creating a test app and running paster serve I can access the default page via my domain name).

As the Pylons docs explain and as I understand, the built in paster serve server is not suited for a production environment. What I am not clear on, then, is what to do next... It seems like nginx is a good option, but I am more familiar with Apache (like .0002%). I plan on having virtualhosts (which nginx says can accomodate). However, I am totally unclear on how the big picture is supposed to work.

  • In order to serve an app, does paster serve need to be running?
    • Does then nginx/apache basically just act as a proxy to shuttle connections to the paster server?
    • How do I start it so it doesn't terminate after closing the ssh connection?
    • If running multiple apps, what do I set as the host/port in development.ini to differentiate the apps? Or if this is not the right way, how do I differentiate beween apps?
  • I am more familiar with MySQL, but willing to negotiate PostgreSQL if it's a better fit. Is it?
  • Is virtualenv a prerequisite to running multiple apps on the same machine?

Thanks in advance for any tips.

share|improve this question
up vote 2 down vote accepted

apache2/mod_wsgi -> pylons


nginx/uwsgi (don't use their mod_wsgi) -> pylons

Why you don't want to use nginx and their mod_wsgi

Virtualenv keeps your dependencies tied with your own sandboxed version of python and the installed packages. If you are running multiple sites, it would be advised to use virtualenvs for each.

You can proxy to paster, but, I prefer mod_wsgi. As to the debate with apache2 versus nginx, nginx will use less memory and provide faster static file serving. Configuring nginx to handle mod_rewrite type functionality is a little different, but, not impossible. With either mod_wsgi or uwsgi, as long as the webserver is running, your application will start when a request is made. You might find it easier to start with apache/mod_wsgi and migrate to nginx later. The number of people that understand apache is far greater than those that understand nginx and most projects are documented assuming apache is going to be used.

If your webserver starts when your ECS instance starts, either wsgi method will start on the first request.

When running multiple apps, you'll have separate wsgi config files or separate .wsgi scripts.

Philosophical debate to choose MySQL versus PostreSQL. SQLAlchemy supports both in Pylons.

share|improve this answer
So essentially with mod_wsgi/uwsgi, when a request for a page is made, the respective module will handle the "paster serve" command? Am I understanding that right? Thanks for the very informative answer! – stormdrain Mar 27 '10 at 2:40
It doesn't call paster, pylons runs using the wsgi interface. Paster is just a simple wsgi web server. – deleted Mar 27 '10 at 3:53
I think I'm starting to get it... I've successfully completed the "Verify wsgi is installed correctly" section of the pylons+wsgi docs, but the information beyond that isn't really clear to a newb like me. I need a pylons+wsgi+apache for dummies :/ Thanks again! – stormdrain Mar 27 '10 at 4:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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