4

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.

2
  • Have you checked your paths? A possibly similar problem was solved here Jul 25, 2013 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. Jul 25, 2013 at 15:10

1 Answer 1

3

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;
        }

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .