Reputation: 10385
I'm trying to get uwsgi to work with python, but nomatter what i do it cant load my app.. i get this error:
unable to load app 0 (mountpoint='uwsgi') (callable not found or import error)
uwsgi.ini:
[uwsgi]
http = 0.0.0.0:8000
module = uwsgi
callable = application
uwsgi.py:
def application(env, start_response):
start_response('200 OK', [('Content-Type', 'text/html')])
return ["Hello!"]
directory structure is like this:
/config/
.... __init__.py
.... uwsgi.ini
.... uwsgi.py
I cant figure out what is wrong. I have been through several examples, articles and answers on this site and nothing has solved the problem for me.. ive tried command line initialization and calling the .ini, I'm at a loss as to what to do, uwsgi seems to find uwsgi.py because I don't receive the module not found error, but for some reason it is unable to load. the stripped down command line init was this command:
uwsgi --ini uwsgi.ini
but I have tried several variations, though obviously none that have worked.
here is the error in its entirety:
[uWSGI] getting INI configuration from /config/uwsgi.ini
*** Starting uWSGI 2.0.14 (64bit) on [Mon Feb 27 08:40:38 2017] ***
compiled with version: 4.9.2 on 26 February 2017 23:44:57
os: Linux-4.4.0-64-generic #85-Ubuntu SMP Mon Feb 20 11:50:30 UTC 2017
nodename: fe627d90246e
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 4
current working directory: /config
detected binary path: /usr/local/bin/uwsgi
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
*** WARNING: you are running uWSGI without its master process manager ***
your memory page size is 4096 bytes
detected max file descriptor number: 1048576
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uWSGI http bound on 0.0.0.0:8000 fd 4
spawned uWSGI http 1 (pid: 7)
uwsgi socket 0 bound to TCP address 127.0.0.1:36530 (port auto-assigned) fd 3
Python version: 3.6.0 (default, Feb 26 2017, 23:43:20) [GCC 4.9.2]
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x1df12c0
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 72768 bytes (71 KB) for 1 cores
*** Operational MODE: single process ***
unable to load app 0 (mountpoint='') (callable not found or import error)
*** no app loaded. going in full dynamic mode ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI worker 1 (and the only) (pid: 1, cores: 1)
Upvotes: 2
Views: 7172
Reputation: 71
check the ownership of the files. uwsgi will run with an unprivileged user. make sure that the www-data or whatever user you use has read access for wsgi.py
Upvotes: 2
Reputation: 5614
This is configuration that works for me, wsgi.py:
def application(env, start_response):
start_response('200 OK', [('Content-Type', 'text/html')])
return ["Hello!"]
and uwsgi.ini:
[uwsgi]
http = 0.0.0.0:8000
module = wsgi
callable = application
and start it like this:
uwsgi --ini uwsgi.ini
Upvotes: 0