Nginx – uwsgi nginx web.py interal server error: application not found

nginxpythonuwsgi

Within my nginx sites-available/default this is the relevant portion for my app:

    location /app/ {       
            include uwsgi_params;
            uwsgi_pass unix:///tmp/uwsgi.socket;
    }

My app.xml file within the uwsgi/sites-available/ folder:

<uwsgi>
    <socket>/tmp/uwsgi.socket</socket>
    <plugins>python</plugins>
    <chdir>/web/NetWeaveCustom</chdir>
    <module>index</module>
</uwsgi>

Finally my /web/NetWeaveCustom/index.py module is as follows:

import web

urls = (
    '/(.*)','index'
)

app = web.application(urls, globals()).wsgifunc()

class index:
    def GET(self,name):
        return name

Here is my uwsgi error log:

[pid: 15963|app: -1|req: -1/15] 192.168.1.98 () {42 vars in 686 bytes} [Sun Dec 30 18:51:37 2012] GET /app/ => generated 48 bytes in 0 msecs (HTTP/1.1 500) 2 headers in 63 bytes (0 switches on core 0)
[pid: 15963|app: -1|req: -1/16] 192.168.1.98 () {42 vars in 686 bytes} [Sun Dec 30 18:51:54 2012] GET /app/ => generated 48 bytes in 0 msecs (HTTP/1.1 500) 2 headers in 63 bytes (0 switches on core 0)
[pid: 15964|app: -1|req: -1/17] 192.168.1.98 () {42 vars in 686 bytes} [Sun Dec 30 18:51:55 2012] GET /app/ => generated 48 bytes in 0 msecs (HTTP/1.1 500) 2 headers in 63 bytes (0 switches on core 0)
[pid: 15963|app: -1|req: -1/18] 192.168.1.98 () {42 vars in 686 bytes} [Sun Dec 30 18:51:55 2012] GET /app/ => generated 48 bytes in 0 msecs (HTTP/1.1 500) 2 headers in 63 bytes (0 switches on core 0)

When I got to my server/app/ folder I get the following error:

uWSGI Error:
Python application not found.

There are no errors reported in the nginx error log.

The strange thing is that this was working quite well until I decided to restart the uwsgi service. As soon as I did this error happened.

Any suggestions as to what is going wrong here?

Best Answer

uWSGI searches for the 'application' callable, while you are defining an 'app' one.

Use

<module>index:app</module>

or add

<callable>app</callable>