I am trying to get a uwsgi environment working correctly on Arch, to run my Flask application from a virtualenv.
I have installed uwsgi, nginx and virtualenv and these all work to a point.
However I am seeing the following error in the uwsgi
log:
Traceback (most recent call last):
File "./interface.py", line 1, in <module>
from flask import flask
ImportError: No module named flask
unable to load app 0 (mountpoint='') (callable not found or import error)
unable to find "application" callable in file index.py
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 master process (pid: 4795)
spawned uWSGI worker 1 (pid: 4796, cores: 1)
--- no python application found, check your startup logs for errors ---
[pid: 4796|app: -1|req: -1/1] 192.168.9.201 () {40 vars in 664 bytes} [Thu Dec 26 08:01:56 2013] GET / => generated 21 bytes in 0 msecs (HTTP/1.1 500) 2 headers in 83 bytes (0 switches on core 0)
This indicates that it can't load the flask module, which I am guessing is due to an incorrect uwsgi.conf
:
[uwsgi]
uid = http
gid = http
plugin = python2
socket = %drun/%n.sock
chdir = /srv/http/example/htdocs
master = True
pidfile = %drun/%n.pid
logto = %dlog/%n.log
venv = /srv/http/example/htdocs
pyhome = /srv/http/example/htdocs
module = interface
callable = my_app
no-site = true
Can anyone tell me what I should be setting venv
and pyhome
to, as I think this is where the problem lies? Or in fact if I should be setting both?
Also relevant, is when I run the following from a terminal, I can import the flask module without errors:
$ pwd
/srv/http/example/htdocs
$ . bin/activate
(htdocs) $ python
Python 2.7.6 (default, Nov 26 2013, 12:52:49)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import flask
>>>
Am I just setting venv
in uwsgi.conf
incorrectly?
nosite
I'm guessing) has fixed this. – v25 Dec 26 '13 at 23:55