Articles of uwsgi

uwsgi导入错误:没有名为“编码”的模块

我正在尝试用uwsgi设置烧瓶。 这是我的目录结构: /srv/http/www/myapp | +– env -> virtualenv | +– mpd -> the project directory | +– main.py -> main application 我正在使用这个命令: uwsgi -s 127.0.0.1:3002 –chdir webmpd –uid 33 –gid 33 –plugin python -H env –module main –callable app 我得到这个错误: *** Starting uWSGI 1.9.19 (32bit) on [Sat Nov 30 22:37:33 2013] *** compiled with version: […]

Django没有使用uWSGI为pipe理页面findCSS文件

即使我遵循官方指示 ,当我使用uWSGI启动Djangotesting站点时,pipe理界面的CSS文件也不会被加载。 如果我打开CSS文件的URL,例如http://localhost:8443/static/admin/css/base.css ,我得到一个404错误。 我search了本地文件,我猜它的path是/usr/local/lib/python3.3/dist-packages/django/contrib/admin/static/admin/css/base.css ; 所以我也尝试以root身份运行uwsgi,但没有任何改变。 我没有问题使用python3 manage.py runserver 。 如果打开http://localhost:8000/static/admin/css/base.css ,则文件将在浏览器中加载,并将样式应用于pipe理页面。 这是我在bash中执行的命令: uwsgi –ini ~/.uwsgi/conf/django.ini –set-placeholder project_name=mysite –set-placeholder port=8443 这是django.ini的内容: [uwsgi] module = %(project_name).wsgi:application https = :%(port),/usr/local/nginx/conf/server.crt,/usr/local/nginx/conf/server.key,HIGH strict = true chdir = /home/marco/django-projects/%(project_name) env = DJANGO_SETTINGS_MODULE=%(project_name).settings socket = /home/marco/.uwsgi/%(project_name).socket pidfile = /home/marco/.uwsgi/%(project_name).pid daemonize = /home/marco/.uwsgi/%(project_name).log master = true enable-threads = true harakiri = […]

为什么Django项目失败部署? – django + nginx + uwsgi

我正试图通过Nginx和uWSGI部署一个Django项目。 如果我运行该项目手动运行python manage.py runserver :8000它工作正常,所以项目本身不是我猜的问题。 我在一个专用的virtualenv中安装了Django和依赖关系,并把这个项目放在里面。我还在virtualenv的外面安装了nginx和uwsgi,并开始创buildconfiguration文件: /etc/nginx/sites-available/myproject (在启用了网站的系统中进行符号链接): upstream uwsgi_myproject { server 127.0.0.1:5678; } server { listen 80; server_name my.url.net; set $home /path/to/myvirtualenv; access_log /path/to/myvirtualenv/log/access_uwsgi.log; error_log /path/to/myvirtualenv/log/error_uwsgi.log; client_max_body_size 10m; keepalive_timeout 120; location / { uwsgi_pass uwsgi_myproject; include uwsgi_params; gzip on; uwsgi_param UWSGI_CHDIR $home/path/to/myproject; uwsgi_param UWSGI_SCRIPT uwsgi; uwsgi_param UWSGI_PYHOME $home; root $home; } location /static/ { […]

uWSGI TCP / IP主机:端口vs Unix套接字

我们正在运行Python WSGI服务器(uWSGI),并更改为套接字文件而不是tcp / ip localhost:port连接。 现在我们的uwsgi日志充满了像这样的错误 IOError: write error SIGPIPE: writing to a closed pipe/socket/fd (probably the client disconnected) during GET /en/photos/?orientation… (ip …) !!! uwsgi_response_write_headers_do(): Broken pipe [core/writer.c line 296] during GET /en/photos/?orientation… (ip …) 改回本地主机:端口,日志中没有错误。 页面正在加载两种configuration。 我们更喜欢Unix套接字,因为它们速度更快一些…有没有人知道是什么原因导致了这个错误? uwsgi.ini: daemonize = /var/log/uwsgi/debug.log module = project.wsgi:application socket=127.0.0.1:1111 #socket = /tmp/tmp.sock #chmod-socket = 666 master = […]

Mutli-Site uWSGIconfiguration

我有大约十几个我想用Nginx和uWSGI运行的小Django站点。 他们在一个4核心的服务器上有8个ram的演出。 每个站点是否应该在自己的套接字上进行configuration,以及如何控制所有uWSGI实例的进程总数? 如果每个应用程序有30个进程,我怎样才能防止内存不足?

UWSGI不能用nginx和flask导入模块“mysite”

我是新使用uwsgi和nginx,我一直无法弄清楚为什么我从uwsgi得到这个错误: ImportError: No module named mysite unable to load app 0 (mountpoint='my_ipaddr|') (callable not found or import error) 这是我的nginxconfiguration文件: server { listen 80; server_name my_ipaddr; location /static { alias /var/www/mysite/static; } location / { include uwsgi_params; uwsgi_pass unix:/tmp/mysite.sock; uwsgi_param UWSGI_PYHOME /var/www/mysite/venv; uwsgi_param UWSGI_CHDIR /var/www/mysite; uwsgi_param UWSGI_MODULE app; uwsgi_param UWSGI_CALLABLE app; } 这是我的uwsgi的mysite.ini: [uwsgi] vhost=true socket=/tmp/mysite.sock […]

Bottle.py应用程序不能被nginx + uwsgifind

我有一个Python 3 bottle.py应用程序,我安装到虚拟环境(让PIP自动获取依赖)。 我试图让它在我的覆盆子pi下运行在nginx和uwsgi下。 当我运行nginx和uwsgi时,访问http://localhost/icecrate导致“uWSGI Error Python application not found”。 我假设这意味着nginx正确连接到uwsgi,并且它是uwsgi无法find应用程序。 但是,如果我用uwsgi –http 0.0.0.0:8080 /etc/uwsgi/apps-enabled/icecrate.ini运行应用程序,那么http://localhost:8080会给我应用程序,这表明uwsgiconfiguration至less是充足。 我一直在search谷歌和文档几个小时的解决scheme。 我不知道我在这里做错了什么。 在/ etc / nginx的/网站可用/ icecrate server { listen 80; server_name raspberrypi; access_log /home/icecrate/logs/access.log; error_log /home/icecrate/logs/error.log; location /icecrate { uwsgi_pass unix:///tmp/icecrate.sock; include uwsgi_params; } } /etc/uwsgi/apps-available/icecrate.ini [uwsgi] vhost = true plugins = python3 socket = /tmp/icecrate.sock master = true […]

Python的uWSGI日志没有读取权限

我通过EC2 Ubuntu 14.04 LTS在uWSGI上运行Python Flask服务器。 服务器configuration如下: [uwsgi] http-socket = :9000 plugin = python wsgi-file = /path/to_wsgi.py enable-threads = true 但是,日志是使用根权限创build的,不具有读权限: $ ls -ltrh /var/log/uwsgi/app total 34M -rw-r—– 1 root root 2.3M Jun 4 06:50 reporter-uwsgi.log.2.gz -rw-r—– 1 root root 24M Jun 5 06:51 reporter-uwsgi.log.1 -rw-r—– 1 root root 8.4M Jun 5 17:27 reporter-uwsgi.log 这是一个烦恼,因为我的一些脚本以普通用户身份运行并parsing这些日志。 任何想法如何configurationuWSGI写入全局读取权限?

uWSGI在Ubuntu 16.04下不会启动systemd

我正在做一个从Ubuntu 12.04到16.04的暂存和生产服务器有点痛苦的迁移过程。 我正在testing迁移的阶段,它主要是工作,除了让uWSGI在systemd下启动(它以前在Upstart下工作得很好)。 这工作没有问题: uwsgi –ini /etc/uwsgi/my_wsgi.ini 但是运行以下操作不起作用(uWSGI不启动,但不会产生错误): sudo systemctl start uwsgi 我在/etc/systemd/system/uwsgi.service中创build了以下服务: [Unit] Description=uWSGI Service [Service] ExecStart=/usr/local/bin/uwsgi –ini /etc/uwsgi/my_wsgi.ini Restart=always RestartSec=5 KillSignal=SIGQUIT Type=notify NotifyAccess=all [Install] WantedBy=multi-user.target 和my_wsgi.ini具有以下内容: [uwsgi] # Django-related settings # the base directory (full path) chdir = /path/to/project/hidden # Django's wsgi file module = wsgi # process-related settings # master master = […]

Nginx + uWsgi + Flask无法设置成功

我想在centos 5上使用nginx,uWsgi,Flask,但总是有一些错误。 3应用程序都是最新版本,uwgsi_params文件从uwsgi / nginx复制。 我使用virtualenv来configurationpython env。 project path: /path/to/project virtualevn: /path/to/virenv/pyenv27 第一步: 我使用nginx和uWsgi,并浏览显示错误页面: uWSGI Error wsgi application not found Nginxconfiguration: location / { uwsgi_pass 127.0.0.1:5555; uwsgi_param UWSGI_PYHOME /path/to/virenv/pyenv27; uwsgi_param UWSGI_CHDIR /path/to/project; uwsgi_param UWSGI_SCRIPT uwsgi; uwsgi_param SCRIPT_NAME ""; include uwsgi_params; } 烧瓶文件很简单: import sys sys.path.append(sys.path[0]) from flask import Flask app = Flask(__name__) @app.route('/') def hello_world(): […]