Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm new to using uwsgi and nginx and I haven't been able to figure out why I am getting this error from uwsgi:

ImportError: No module named mysite
unable to load app 0 (mountpoint='my_ipaddr|') (callable not found or import error)

Here is my nginx config file:

server {
    listen   80;
    server_name my_ipaddr;

    location /static {
      alias /var/www/mysite/static;
    }

    location / {
          include      uwsgi_params;
          uwsgi_pass   unix:/tmp/mysite.sock;
          uwsgi_param  UWSGI_PYHOME  /var/www/mysite/venv;
          uwsgi_param  UWSGI_CHDIR /var/www/mysite;
          uwsgi_param  UWSGI_MODULE app;
          uwsgi_param  UWSGI_CALLABLE app;
    }

Here is my mysite.ini for uwsgi:

[uwsgi]
vhost=true
socket=/tmp/mysite.sock
venv = /var/www/mysite/venv

Here is my app.py:

from flaskext.markdown import Markdown
from views import app

Markdown(app)

def main():
    app.run()

if __name__ == '__main__':
    main()

I am able to run the app with uwsgi when launching it from the command line but I haven't been able to get it working with nginx using the above setup.

share|improve this question
    
Have you checked your paths? A possibly similar problem was solved here –  Deer Hunter Jul 25 '13 at 14:14
    
I'm not able to post an answer right now because I don't have enough reputation, but I solved this by moving the uwsgi settings from nginx to mysite.ini. –  Mark Berger Jul 25 '13 at 15:10
add comment

1 Answer

up vote 1 down vote accepted

Moving the settings from nginx to uswgi solved my problem:

mysite.ini:

[uwsgi]
vhost=true
socket=/tmp/mysite.sock
venv = /var/www/mysite/venv
chdir = /var/www/mysite
module = app
callable = app

nginx config file:

server {
        listen   80;
        server_name my_ipaddr;

        location /static {
          alias /var/www/mysite/static;
        }

        location / {
              include      uwsgi_params;
              uwsgi_pass   unix:/tmp/mysite.sock;
        }
share|improve this answer
add comment

Your Answer

 
discard

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.