我在uwsgi / emeror / Nginx服务器上编码有很大问题.
我的应用程序开发为批处理excel文件处理.
我使用最新版本的烧瓶和烧瓶扩展,并使用flask-excel.
我的应用程序在Digital Ocean / ubuntu服务器上运行,我的配置文件是:
/etc/init/uwsgi.conf
description "uWSGI"
start on runlevel [2345]
stop on runlevel [06]
respawn
env UWSGI=/home/lukas/www/abissk/venv/bin/uwsgi
env LOGTO=/home/lukas/logs/abissk/emperor.log
exec $UWSGI --master --emperor /etc/uwsgi/vassals --die-on-term --uid www-data --gid www-data --logto $LOGTO
/etc/uwsgi/vassals/abissk_uwsgi.ini
[uwsgi]
plugins = python
#pcre = True
#application's base folder
base = /home/lukas/www/abissk/
#enable-threads = true
#python module to import
app = wsgi
module = %(app)
home = %(base)venv
pythonpath = %(base)
#socket file's location
socket = /home/lukas/www/abissk/%n.sock
#permissions for the socket file
chmod-socket = 644
#the variable that holds a flask application inside the module imported at line #6
callable = app
#location of log files
logto = /home/lukas/logs/abissk/%n.log
/home/lukas/www/abissk/wsgi.py
# -*- coding: utf-8 *-*
from app.app import create_app
from app.settings import ProdConfig
app = create_app(config_object=ProdConfig)
在/ etc / Nginx的/启用的站点 – / abissk_Nginx
server {
listen 80;
server_name benela.abis.sk;
charset utf-8;
client_max_body_size 75M;
location / { try_files $uri @yourapplication; }
location @yourapplication {
include uwsgi_params;
uwsgi_pass unix:/home/lukas/www/abissk/abissk_uwsgi.sock;
}
}
这是我的问题:
使用命令启动应用程序时:
~/www/abissk/venv/bin/uwsgi --ini /etc/uwsgi/vassals/abissk_uwsgi.ini
当使用emperor与完全相同的配置文件(在/etc/init/uwsgi.conf中)启动相同的应用程序时,应用程序工作正常,但是当上传excel文件到批处理时,我只看到消息:“502 Bad Gateway”并在我的日志中是:
UnicodeEncodeError: 'ascii' codec can't encode character '\xfd' in position 31: ordinal not in range(128)
我尝试使用apt-get / pip3安装安装uwsgi并且场景相同:当没有皇帝直接运行应用程序时,工作正常;当使用emperor运行应用程序(具有相同配置)时,每个上传excel文件到我的应用程序以崩溃结束:/
谢谢你的回答
最佳答案
原文链接:https://www.f2er.com/nginx/434348.html