Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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 want use nginx, uWsgi, Flask on centos 5, but always has some error.

3 app are all newest version, the uwgsi_params file copy from uwsgi/nginx.

I use virtualenv to config python env.

project path: /path/to/project
virtualevn: /path/to/virenv/pyenv27

First step:

I use nginx and uWsgi, and browse show error page:

uWSGI Error
wsgi application not found

Nginx config:

location / {
      uwsgi_param UWSGI_PYHOME /path/to/virenv/pyenv27;
      uwsgi_param UWSGI_CHDIR /path/to/project;
      uwsgi_param UWSGI_SCRIPT uwsgi;
      uwsgi_param SCRIPT_NAME "";

      include uwsgi_params;


Flask file is simple:

import sys

from flask import Flask
app = Flask(__name__)

def hello_world():
    return "Hello World!"


def application(environ, start_response):
    return app(environ, start_response)

if __name__ == '__main__':

uWsgi command:

/opt/uwsgi -s -M 4 -t 30 -A 4 -p 4 -d /var/log/uwsgi.log --pidfile /var/run/ --no-site --vhost --limit-as 256 

2 Step

I use uWsgi only.


/opt/uwsgi/uwsgi --xml /path/to/project/uwsgi.xml

but I got error:

ImportError: No module named site

uWsgi xml:





<master />

<disable-logging>false</disable-logging><!-- Errors are still logged; this just disables request logging which Cherokee takes care of -->
<vacuum />
<no-orphans />

Is there something wrong here?

share|improve this question

migrated from Jun 3 '11 at 18:58

This question came from our site for professional and enthusiast programmers.

In your command-line version, you have:

/opt/uwsgi -s --no-site

But in your xml version, you are missing an equivalent no-site option:


so it's trying to load the Python file. You could also add an empty file, but I'd go with the xml option. And

<no-site />

is also valid syntax, I tend to use the true flag, myself.

share|improve this answer

Your Answer


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