我在试着安装一个瓶子的应用程序。
我在Debian 8 (Jessie)上有python2.7和3.4,uwsgi是从APT安装的。我现在的应用程序运行在python3.4下,为此我制作了一个VirtualEnv。
当我重新加载uwsgi服务时,会出现这个问题,它没有找到安装在虚拟服务器中的正确模块。但是我在uwsgi .ini文件中有"virtualenv“条目。
更新:
多亏了@Angelásquez,我才修正了错误,但问题还在继续。
我看到uWSGI忽略了安装在虚拟服务器上的python版本,并尝试使用默认系统的python版本运行应用程序。
我怎么能让那个环境开始工作呢?
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输出
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)原始设置
当我将"pythonpath“条目与virtualenv的站点包路径放在一起时,问题就”解决了“。
这样做对吗?为什么uwsgi忽略了"virtualenv“条目?
谢谢,为我丑陋的英语道歉!
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产出:
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 ***丑陋的修复模式:
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产出:
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 ***发布于 2015-10-20 13:50:03
这个问题在安装uwsgi-plugin 3:之后得到了解决。)
最后一个config.ini是
[uwsgi]
plugin = python3
virtualenv = /srv/virtualenv/donde
uid = www-data
gid = www-data
chdir = /srv/http/donde
file = app.py
processes = 2
threads = 2发布于 2015-10-18 02:13:23
似乎您的配置上有一个错误,上面写着virualenv而不是virtualenv。
https://stackoverflow.com/questions/33193581
复制相似问题