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 got nginx + uWSGI running on localhost inside a virtualenv with a simple hello world program, but I get this error when I replace the hello world with a simple Flask app:

File "./", line 1, in <module>
    from flask import Flask
ImportError: No module named flask
unable to load app mountpoint

Here's the flask app (

from flask import Flask
application = Flask(__name__)

def hello():
    return "hello world"

if __name__ == "__main__":

uWSGI config (app_conf.xml):


nginx config:

server {
    listen   80;
    server_name localhost;
    access_log /srv/www/labs/logs/access.log;
    error_log /srv/www/labs/logs/error.log;

    location / {
        include        uwsgi_params;

    location /static {
        root   /srv/www/labs/public_html/static/;
        index  index.html index.htm;

virtualenv stored in ~/virtual_env with Python 2.7 + nginx + uWSGI + Flask installed in a virtualenv called basic.

Things I've tried to solve this:

  1. set the --home (-H) option to my virtualenv folder ~/virtual_env while running uWSGI.

Other info:

  1. I have the same setup working outside of a virtualenv. Things go wrong only when I try to replicate the setup inside of a virtualenv.

Where have I gone wrong?

share|improve this question
up vote 4 down vote accepted

Just add path to your virtual env to <pythonpath> in uwsgi's app_conf.xml file. eg:

share|improve this answer

the -H/--home/--virtualenv option does not expand the ~ symbol. Specify it as an absolute path and it should work.

The same apply to configfiles, so you would add


share|improve this answer

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.