【问题标题】:uwsgi can't load app when set up nginx+django service on centoscentos上设置nginx+django服务时uwsgi无法加载app
【发布时间】:2018-03-19 00:20:24
【问题描述】:

centos7、python3.6.3、django1.11、uwsgi2.0.15 当我运行命令'uwsgi --ini djcode_uwsgi.ini'时,没有加载任何应用程序,消息如下:

[uWSGI] getting INI configuration from djcode_uwsgi.ini
    > open("/usr/lib64/uwsgi/python3_plugin.so"): No such file or directory
    > [core/utils.c line 3686] !!! UNABLE to load uWSGI plugin:
    > /usr/lib64/uwsgi/python3_plugin.so: cannot open shared object file: No
    > such file or directory !!!
    > *** Starting uWSGI 2.0.15 (64bit) on [Sat Oct  7 16:47:06 2017] *** compiled with version: 4.8.5 20150623 (Red Hat 4.8.5-11) on 19 May
    > 2017 14:33:49 os: Linux-3.10.0-514.26.2.el7.x86_64 #1 SMP Tue Jul 4
    > 15:04:05 UTC 2017 nodename: izuf64a9gck8o1inxenp1cz machine: x86_64
    > clock source: unix pcre jit disabled detected number of CPU cores: 1
    > current working directory: /home/djcode detected binary path:
    > /usr/sbin/uwsgi uWSGI running as root, you can use
    > --uid/--gid/--chroot options
    > *** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***  chdir() to /home/djcode your processes number limit is 3889 your memory page size is 4096 bytes detected max file descriptor number:
    > 65535 lock engine: pthread robust mutexes thunder lock: disabled (you
    > can enable it with --thunder-lock) uwsgi socket 0 bound to TCP address
    > :8001 fd 3 your server socket listen backlog is limited to 100
    > connections your mercy for graceful operations on workers is 60
    > seconds mapped 363840 bytes (355 KB) for 4 cores
    > *** Operational MODE: preforking ***
    > *** no app loaded. going in full dynamic mode ***
    > *** uWSGI is running in multiple interpreter mode *** spawned uWSGI master process (pid: 7787) spawned uWSGI worker 1 (pid: 7788, cores:
    > 1) spawned uWSGI worker 2 (pid: 7789, cores: 1) spawned uWSGI worker 3
    > (pid: 7790, cores: 1) spawned uWSGI worker 4 (pid: 7791, cores: 1)

django_uwsgi.ini 中的设置:

#wsgi.ini file
[uwsgi]
plugin = python3
# Django-related settings

socket = :8001
callable = app
# the base directory (full path)
chdir           = /home/djcode

# Django s wsgi file
module          = djcode.wsgi

# process-related settings
# master
master          = true

# maximum number of worker processes
processes       = 4

# ... with appropriate permissions - may be needed
# chmod-socket    = 664
# clear environment on exit
vacuum          = true

我已经安装了 uwsgi-plugin-python。有什么建议吗?

我现在安装uwsgi-plugin-python3,现在的错误信息如下:

[uWSGI] 从 djcode_uwsgi.ini 获取 INI 配置 * 在 [Sat Oct 7 18:07:27 2017] 开始 uWSGI 2.0.15(64 位) 编译版本为:4.8.5 20150623(Red Hat 4.8.5- 11) 5 月 19 日 2017 14:33:49 操作系统:Linux-3.10.0-514.26.2.el7.x86_64 #1 SMP 7 月 4 日星期二 15:04:05 UTC 2017 节点名:izuf64a9gck8o1inxenp1cz 机器:x86_64 时钟源:unix pcre jit disabled 检测到的 CPU 内核数:1 当前工作目录:/home/djcode 检测到的二进制路径: /usr/sbin/uwsgi uWSGI 作为 root 运行,你可以使用 --uid/--gid/--chroot 选项 警告:你正在以 root 身份运行 uWSGI !!! (使用 --uid 标志) chdir() 到 /home/djcode 你的进程数限制是 3889 你的内存页面大小是 4096 字节检测到的最大文件描述符数: 65535 锁引擎:pthread 强大的互斥锁迅雷锁:禁用(您 可以使用 --thunder-lock 启用它)绑定到 TCP 地址的 uwsgi 套接字 0 :8001 fd 3 Python 版本:3.4.5(默认,2017 年 5 月 29 日,15:17:55) [GCC 4.8.5 20150623(红帽 4.8.5-11)] Python 线程支持已禁用。您可以使用 --enable-threads 在 0x12e9940 初始化的 Python 主解释器启用它 您的服务器套接字侦听积压限制为 100 个连接 对工人的优雅操作的怜悯是 60 秒映射 363840 4 个内核的字节 (355 KB) Operational MODE: preforking Traceback(最近一次调用最后一次):文件“./djcode/init.py”,第 1 行,in import pymysql ImportError: No module named 'pymysql' unable to load app 0 (mountpoint='') (callable not found or import error) 未加载任何应用。进入全动态模式 uWSGI 在多解释器模式下运行 * 衍生 uWSGI 主进程 (pid: 8035) 衍生 uWSGI worker 1 (pid: 8036, cores: 1) 生成的 uWSGI 工作者 2 (pid: 8037, cores: 1) 生成的 uWSGI 工作者 3 (pid: 8038, cores: 1) 产生 uWSGI worker 4 (pid: 8039, cores: 1)

删除插件 = python3:

[uWSGI] 从 djcode_uwsgi.ini 获取 INI 配置 * 在 [Sat Oct 7 21:37:08 2017] 开始 uWSGI 2.0.15(64 位) 编译版本:4.8.5 20150623(Red Hat 4.8.5- 11) 5 月 19 日 2017 14:33:49 操作系统:Linux-3.10.0-514.26.2.el7.x86_64 #1 SMP 7 月 4 日星期二 15:04:05 UTC 2017 节点名:izuf64a9gck8o1inxenp1cz 机器:x86_64 时钟源:unix pcre jit disabled 检测到的 CPU 内核数:1 当前工作目录:/home/djcode 检测到的二进制路径: /usr/sbin/uwsgi uWSGI 作为 root 运行,你可以使用 --uid/--gid/--chroot 选项 警告:你正在以 root 身份运行 uWSGI !!! (使用 --uid 标志) chdir() 到 /home/djcode 你的进程数限制是 3889 你的内存页面大小是 4096 字节检测到的最大文件描述符数: 65535 锁引擎:pthread 强大的互斥锁迅雷锁:禁用(您 可以使用 --thunder-lock 启用它)绑定到 TCP 地址的 uwsgi 套接字 0 :8001 fd 3 您的服务器套接字侦听积压限制为 100 连接你对工人优雅操作的怜悯是 60 4 核的秒数映射 363840 字节 (355 KB) 操作模式:预分叉 未加载任何应用。进入全动态模式 uWSGI 在多解释器模式下运行 * 衍生 uWSGI 主进程 (pid: 8387) 衍生 uWSGI worker 1 (pid: 8388, cores: 1) 生成的 uWSGI 工作者 2 (pid: 8389, cores: 1) 生成的 uWSGI 工作者 3 (pid: 8390, cores: 1) 产生 uWSGI worker 4 (pid: 8391, cores: 1)

更改 callable=应用程序:

[uWSGI] 从 djcode_uwsgi.ini 获取 INI 配置 * 在 [Thu Oct 12 15:42:00 2017] 开始 uWSGI 2.0.15(64 位) 编译版本为:4.8.5 20150623(Red Hat 4.8.5- 11) 5 月 19 日 2017 14:33:49 操作系统:Linux-3.10.0-514.26.2.el7.x86_64 #1 SMP 7 月 4 日星期二 15:04:05 UTC 2017 节点名:izuf64a9gck8o1inxenp1cz 机器:x86_64 时钟源:unix pcre jit disabled 检测到的 CPU 内核数:1 当前工作目录:/home/djcode 检测到的二进制路径: /usr/sbin/uwsgi uWSGI 作为 root 运行,你可以使用 --uid/--gid/--chroot 选项 警告:你正在以 root 身份运行 uWSGI !!! (使用 --uid 标志) chdir() 到 /home/djcode 你的进程数限制是 3889 你的内存页面大小是 4096 字节检测到的最大文件描述符数: 65535 锁引擎:pthread 强大的互斥锁迅雷锁:禁用(您 可以使用 --thunder-lock 启用它)绑定到 TCP 地址的 uwsgi 套接字 0 :8001 fd 3 您的服务器套接字侦听积压限制为 100 连接你对工人优雅操作的怜悯是 60 4 核的秒数映射 363840 字节 (355 KB) 操作模式:预分叉 未加载任何应用。进入全动态模式 uWSGI 在多解释器模式下运行 * 衍生 uWSGI 主进程 (pid: 17756) 衍生 uWSGI worker 1 (pid: 17757, cores: 1) 生成的 uWSGI 工作者 2 (pid: 17758, cores: 1) 生成的 uWSGI 工作者 3 (pid: 17759, cores: 1) 产生 uWSGI worker 4 (pid: 17760, cores: 1)

【问题讨论】:

  • 从你的ini中删除plugin = python3
  • pymysql 已导入,但仍没有加载应用
  • 更新有问题的新消息
  • 更新了............
  • djcode/wsgi.py的内容是什么?

标签: django nginx centos uwsgi


【解决方案1】:

我认为你安装了错误的包。

尝试安装 uwsgi-plugin-python3。

【讨论】:

  • 删除旧的并重新安装uwsgi-plugin-python3,没有任何变化
  • 在我的 question.import pymysql ImportError: No module named 'pymysql' 中编辑,我需要在我的 init.py 中导入 pymysql。这个错误在我安装 uwsgi-plugin-python 时解决了
  • 问题在错误跟踪本身中给出: Traceback (most recent call last): File "./djcode/init.py", line 1, in import pymysql ImportError: No module named 'pymysql'
猜你喜欢
  • 2014-02-01
  • 2012-07-21
  • 2018-10-06
  • 2019-03-15
  • 2014-03-14
  • 2014-02-05
  • 1970-01-01
  • 1970-01-01
  • 2011-03-12
相关资源
最近更新 更多