I'm trying to setup an Bottle's app.
I'm on Debian 8 (Jessie) with python2.7 and 3.4 and the uwsgi installed from APT. My current app runs under python3.4 and I made a VirtualEnv for this purpose.
The problem appears when I reload the uwsgi service, it does not found the proper modules installed in the virtualenv. But I have the "virtualenv" entry in the uwsgi .ini file.
UPDATE:
Thanks to @Angel Velásquez I fixed the typo but the problem continues.
I see that uWSGI are ignoring the python's version installed on the virtualenv and tries to run the app with the default system's python version.
How I can get that environment starts to working?
config.ini
[uwsgi]
plugins = python3
virtualenv = /srv/virtualenv/donde
pythonpath = /srv/virtualenv/donde/lib/python3.4/site-packages
no-site = True
uid = www-data
gid = www-data
chdir = /srv/http/donde
file = app.py
processes = 2
threads = 2
output
Sat Oct 17 23:35:30 2015 - added /srv/virtualenv/donde/lib/python3.4/site-packages/ to pythonpath.
Traceback (most recent call last):
File "app.py", line 1, in <module>
from bottle import Bottle, request, abort, template, static_file, jinja2_view
File "/srv/virtualenv/donde/lib/python3.4/site-packages/bottle.py", line 16, in <module>
from __future__ import with_statement
ImportError: No module named __future__
Sat Oct 17 23:35:30 2015 - unable to load app 0 (mountpoint='') (callable not found or import error)
ORIGINAL SETUP
The problem becomes "solved" when I put the "pythonpath" entry with the virtualenv's site-packages path.
Is this the correct way? Why uwsgi ignores the "virtualenv" entry?
Thanks and sorry for my ugly English!
config.ini
[uwsgi]
plugins = python3
virualenv = /srv/virtualenv/donde
uid = www-data
gid = www-data
chdir = /srv/http/donde
file = app.py
processes = 2
threads = 2
output:
Sat Oct 17 22:57:48 2015 - *** Operational MODE: preforking+threaded ***
Traceback (most recent call last):
File "app.py", line 1, in <module>
from bottle import Bottle, request, abort, template, static_file, jinja2_view
ImportError: No module named bottle
Sat Oct 17 22:57:48 2015 - unable to load app 0 (mountpoint='') (callable not found or import error)
Sat Oct 17 22:57:48 2015 - *** no app loaded. going in full dynamic mode ***
Sat Oct 17 22:57:48 2015 - *** uWSGI is running in multiple interpreter mode ***
Ugly fix mode:
config.ini
[uwsgi]
plugins = python3
virualenv = /srv/virtualenv/donde
pythonpath = /srv/virtualenv/donde/lib/python3.4/site-packages
uid = www-data
gid = www-data
chdir = /srv/http/donde
file = app.py
processes = 2
threads = 2
output:
Sat Oct 17 23:00:58 2015 - *** Operational MODE: preforking+threaded ***
Sat Oct 17 23:00:58 2015 - added /srv/virtualenv/donde/lib/python3.4/site-packages/ to pythonpath.
Sat Oct 17 23:00:58 2015 - WSGI app 0 (mountpoint='') ready in 0 seconds on interpreter 0xce1000 pid: 19196 (default app)
Sat Oct 17 23:00:58 2015 - *** uWSGI is running in multiple interpreter mode ***
The problem was resolved after install uwsgi-plugin-python3 :)
The final config.ini is this
[uwsgi]
plugin = python3
virtualenv = /srv/virtualenv/donde
uid = www-data
gid = www-data
chdir = /srv/http/donde
file = app.py
processes = 2
threads = 2