我正在尝试在 ubuntu 服务器上运行我的网站。我遵循 digitalocean 的步骤,因为我有他们的 vps 服务器。可以看教程here 。我只需要一台服务器,所以我还没有完成第二个站点部分。请我的 mkvirtualenv
命令在 root
而不是 home 中创建“Env”文件夹。我不知道它是怎么做的,但我尝试了两次,破坏了水滴并再次创建。两次都是一样的。
我的 /etc/uwsgi/sites/app.ini
文件包含以下代码,
[uwsgi]
project = app
uid = root
base = /root
plugins=python3
pyhome=/root/app
chdir = /root/app
home = /root/app
module = app.wsgi:application
master = true
processes = 5
socket = /run/uwsgi/app.sock
chown-socket = root:www-data
chmod-socket = 660
vacuum = true
因此,每次我尝试使用 sudo uwsgi app.ini --thunder-lock
命令运行 usgi 服务器时,我都会收到以下错误消息。
[uWSGI] getting INI configuration from app.ini
open("./python3_plugin.so"): No such file or directory [core/utils.c line 3684]
!!! UNABLE to load uWSGI plugin: ./python3_plugin.so: cannot open shared object file: No such file or directory !!!
*** Starting uWSGI 2.0.13.1 (64bit) on [Mon Aug 8 04:48:51 2016] ***
compiled with version: 5.4.0 20160609 on 08 August 2016 04:00:28
os: Linux-4.4.0-31-generic #50-Ubuntu SMP Wed Jul 13 00:07:12 UTC 2016
nodename: appserver
machine: x86_64
clock source: unix
detected number of CPU cores: 1
current working directory: /etc/uwsgi/sites
detected binary path: /usr/local/bin/uwsgi
!!! no internal routing support, rebuild with pcre support !!!
chdir() to /root/app
your processes number limit is 1896
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: enabled
uwsgi socket 0 bound to UNIX address /run/uwsgi/app.sock fd 3
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
Python version: 3.5.2 (default, Jul 5 2016, 12:43:10) [GCC 5.4.0 20160609]
Set PythonHome to /root/app
Fatal Python error: Py_Initialize: Unable to get the locale encoding
ImportError: No module named 'encodings'
Current thread 0x00007f74c576a700 (most recent call first):
Aborted (core dumped)
所以我的根目录有 Env
文件夹,并且在 Env
内有另一个文件夹 appdata
其中包含所有 virtualenv 文件。 root
目录中有我的 app
文件夹,其中包含 Django 的应用程序文件。那么谁能告诉我我的配置出了什么问题?
最佳答案
从源代码构建时(例如,使用 pip 或 make 安装时),python 插件内置在二进制文件中。因此,没有 python3_plugin.so
共享库,并且您的 uwsgi 设置中不需要 plugins=python3
行。
类似的问题是answered here .
关于python - uWSGI 未在 Ubuntu 16 服务器中创建套接字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38821553/