【发布时间】:2013-06-15 11:42:44
【问题描述】:
我已经通过apt-get 安装了 uWSGI 和 nginx,并将我的 uwsgi-conf.ini 放在 /etc/uwsgi/apps-available 中并将其符号链接到启用应用程序,并按照相同的过程进行 nginx 配置。
(下面列出的配置文件)
问题是我无法让 uWSGI 启动位于 /usr/share/nginx/www/helloflask/venv 中的 virtualenv
如果我添加行 virtualenv = /usr/share/nginx/www/helloflask/venv 并访问服务器,我会收到 502 Bad Gateway 错误?
如果没有.ini 文件中的virtualenv 行,我会收到以下消息:
uWSGI Error
Python application not found
以下是日志文件中的几行:
Traceback (most recent call last):
File "/usr/share/nginx/www/helloflask/test.py", line 1, in <module>
from application import app
File "/usr/share/nginx/www/helloflask/application.py", line 1, in <module>
from flask import Flask
ImportError: No module named flask
- unable to load app 0 (mountpoint='xx.xx.xxx.xx|') (callable not found or import error)
xx.xx.xxx.xx {address space usage: 134094848 bytes/127MB} {rss usage: 12623872 bytes/12MB} [pid: 29848|app: -1|req: -1/6] 95.166.70.107 () {44 vars in 721 bytes} [Thu May 9 08:40:29 2013] GET /favicon.ico => generated 48 bytes in 5 msecs (HTTP/1.1 500) 2 headers in 63 bytes (0 switches on core 0)
/etc/uwsgi/apps-available/uwsgi-conf.ini
[uwsgi]
plugins = python
gid = nginx
uid = nginx
vhost = true
logdate
socket = 127.0.0.1:3031
master = true
processes = 1
harakiri = 20
limit-as = 128
memory-report
no-orphans = true
/etc/nginx/sites-available/helloflask
server {
listen 80;
server_name xx.xx.xxx.xxx;
location / {
include uwsgi_params;
uwsgi_param UWSGI_CHDIR /usr/share/nginx/www/helloflask/;
uwsgi_param UWSGI_PYHOME /user/share/nginx/www/helloflask/;
uwsgi_param UWSGI_SCRIPT test;
uwsgi_pass 127.0.0.1:3031;
}
}
【问题讨论】:
标签: nginx flask virtualenv uwsgi