我无法在 debian 上使用 uwsgi 正确设置瓶子的应用程序

I can't set up a bottle's app with uwsgi on debian properly

我正在尝试设置 Bottle 的应用程序。

我在 Debian 8 (Jessie) 上 python2.7 和 3.4 以及从 APT 安装的 uwsgi。我当前的应用程序 运行s 在 python3.4 下,我为此制作了一个 VirtualEnv。

当我重新加载 uwsgi 服务时出现问题,它没有找到正确的模块安装在 virtualenv 中。但是我在 uwsgi .ini 文件中有 "virtualenv" 条目。

更新:

感谢@Angel Velásquez 我修正了打字错误,但问题仍然存在。

我看到 uWSGI 忽略了安装在 virtualenv 上的 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 的站点包路径放在一起时,问题就变成了 "solved"。

这是正确的方法吗?为什么 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 ***

您的配置似乎有错字,它说的是 virualenv 而不是 virtualenv

安装 uwsgi-plugin-python3 后问题已解决:)

最后的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