首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >我不能在debian上用uwsgi建立一个瓶子的应用程序

我不能在debian上用uwsgi建立一个瓶子的应用程序
EN

Stack Overflow用户
提问于 2015-10-18 02:06:15
回答 2查看 308关注 0票数 2

我在试着安装一个瓶子的应用程序。

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

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

更新:

多亏了@Angelásquez,我才修正了错误,但问题还在继续。

我看到uWSGI忽略了安装在虚拟服务器上的python版本,并尝试使用默认系统的python版本运行应用程序。

我怎么能让那个环境开始工作呢?

config.ini

代码语言:javascript
复制
[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

输出

代码语言:javascript
复制
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

代码语言:javascript
复制
[uwsgi]
plugins = python3
virualenv = /srv/virtualenv/donde
uid = www-data
gid = www-data
chdir = /srv/http/donde
file = app.py
processes = 2
threads = 2

产出:

代码语言:javascript
复制
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

代码语言:javascript
复制
[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

产出:

代码语言:javascript
复制
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 ***
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2015-10-20 13:50:03

这个问题在安装uwsgi-plugin 3:之后得到了解决。)

最后一个config.ini是

代码语言:javascript
复制
[uwsgi]
plugin = python3
virtualenv = /srv/virtualenv/donde

uid = www-data
gid = www-data
chdir = /srv/http/donde
file = app.py
processes = 2
threads = 2
票数 2
EN

Stack Overflow用户

发布于 2015-10-18 02:13:23

似乎您的配置上有一个错误,上面写着virualenv而不是virtualenv。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/33193581

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档