总结uwsgi+anaconda+django启动遇到的问题

news2024/9/29 11:40:47

一、问题描述

Django中,anconda环境下安装uwsgi,启动遇到的问题:

按照正常的启动方式启动:

uwsgi --ini uwsgi_py.ini

但是报错:

Traceback (most recent call last):
  File "/opt/myproject/myproject/wsgi.py", line 12, in <module>
    from django.core.wsgi import get_wsgi_application
  File "/root/anaconda3/envs/xxx/lib/python3.11/site-packages/django/__init__.py", line 1, in <module>
    from django.utils.version import get_version
  File "/root/anaconda3/envs/xxx/lib/python3.11/site-packages/django/utils/version.py", line 1, in <module>
    import datetime
  File "/root/anaconda3/envs/xxx/lib/python3.11/datetime.py", line 12, in <module>
    import math as _math
ImportError: /root/anaconda3/envs/lottery/lib/python3.11/lib-dynload/math.cpython-311-x86_64-linux-gnu.so: undefined symbol: _PyModule_Add
unable to load app 0 (mountpoint='') (callable not found or import error)
*** no app loaded. going in full dynamic mode ***
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 43924)
spawned uWSGI worker 1 (pid: 43925, cores: 1)
spawned uWSGI worker 2 (pid: 43926, cores: 1)
spawned uWSGI worker 3 (pid: 43927, cores: 1)
spawned uWSGI http 1 (pid: 43928)
--- no python application found, check your startup logs for errors ---
--- no python application found, check your startup logs for errors ---
--- no python application found, check your startup logs for errors ---
--- no python application found, check your startup logs for errors ---

二、分析原因

uwsgi没有起来

三、解决办法:

不管怎么改配置都报这个错,网上很多解答,但是没有成功的。

这个问题的关键是:在anaconda 环境下安装uwsgi

pip install uwsgi

这个不行的,安装成功,但是anaconda环境下使用就会出这个问题。

所以要在anaconda下使用uwsgi,请按照下面的方式去安装:

anaconda search -t conda uwsgi

anaconda show conda-forge/uwsgi

conda install --channel https://conda.anaconda.org/conda-forge uwsgi 

用conda安装uwsgi就可以了。这个应该和conda的环境有关系。

四、附加:

如果还出现问题,估计python版本与uwsgi不兼容,解决办法如下:

1、anconda环境下新建环境:
conda create -n ps39 python=3.9
2、进入指定的环境
conda activate ps39
3、重新运行代码
uwsgi --ini uwsgi_py.ini
4、查看日志,程序运行正常
*** Starting uWSGI 2.0.21 (64bit) on [Wed Sep 25 08:38:32 2024] ***
compiled with version: 11.2.0 on 05 August 2024 19:30:51
os: Linux-5.4.0-196-generic #216-Ubuntu SMP Thu Aug 29 13:26:53 UTC 2024
nodename: python
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 16
current working directory: /root/app/text_detection/script
writing pidfile to /root/app/text_detection/script/pid_uwsgi.pid
detected binary path: /opt/anaconda/install/envs/ps39/bin/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 /root/app/text_detection
your processes number limit is 128219
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to TCP address 172.16.13.157:8010 fd 3
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
Python version: 3.9.19 (main, May  6 2024, 19:43:03)  [GCC 11.2.0]
Python main interpreter initialized at 0xfff4f0
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
python threads support enabled
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 403077 bytes (393 KB) for 2 cores
*** Operational MODE: preforking ***
WSGI app 0 (mountpoint='') ready in 1 seconds on interpreter 0xfff4f0 pid: 868081 (default app)
uWSGI running as root, you can use --uid/--gid/--chroot options
*** WARNING: you are running uWSGI as root !!! (use the --uid flag) *** 
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 868081)
spawned uWSGI worker 1 (pid: 868082, cores: 1)
spawned uWSGI worker 2 (pid: 868083, cores: 1)

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2176584.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

Elasticsearch 8.16 和 JDK 23 中的语言环境变化

作者&#xff1a;来自 Elastic Simon Cooper 随着 JDK 23 即将发布&#xff0c;语言环境信息中有一些重大变化&#xff0c;这将影响 Elasticsearch 以及你提取和格式化日期时间数据的方式。首先&#xff0c;介绍一些背景知识。 什么是语言环境&#xff1f; 每次 Java 程序需要…

【Java】static-静态变量、静态方法、工具类、注意事项、args数组的使用

文章目录 一、静态变量特点调用方式 二、静态方法特点调用方式 三、类的类型1.Javabean类2.测试类3.工具类 四、注意事项从代码方面解释1. 上下文清晰2. 静态变量的访问例子注意 3. 静态方法中没有this关键字原因 4. 静态方法只能访问静态变量和静态方法错误原因解决方法 4.非静…

如何获取钉钉webhook

第一步打开钉钉并登录 第二步创建团队 并且 添加自定义 机器人 即可获取webhook

【流计算】流计算概论

前言 作者在之前写过一个大数据的专栏&#xff0c;包含GFS、BigTable、MapReduce、HDFS、Hadoop、LSM树、HBase、Spark&#xff0c;专栏地址&#xff1a; https://blog.csdn.net/joker_zjn/category_12631789.html?fromshareblogcolumn&sharetypeblogcolumn&sharerI…

待办事项应用SideQuests

赶在国庆长假前&#xff0c;自驾&#x1f697;出去玩了几天。 国庆前的错峰出游简直是太香了&#xff01;一路上&#x1f6e3;️畅通无阻&#xff0c;停车&#x1f17f;️不用抢&#xff0c;吃饭&#x1f354;不用等&#xff0c;景点&#x1f3de;️不用排队&#xff0c;拍照&…

Flume实战--Flume中的拦截器详解与操作

在处理大规模数据流时&#xff0c;Apache Flume 是一款功能强大的数据聚合工具&#xff0c;它可以通过拦截器在运行时对Event进行修改或丢弃。本文将详细讲解Flume中的拦截器&#xff0c;包括时间戳拦截器、Host添加拦截器、静态拦截器以及如何自定义拦截器。 拦截器 拦截器的…

《HelloGitHub》第 102 期

兴趣是最好的老师&#xff0c;HelloGitHub 让你对编程感兴趣&#xff01; 简介 HelloGitHub 分享 GitHub 上有趣、入门级的开源项目。 github.com/521xueweihan/HelloGitHub 这里有实战项目、入门教程、黑科技、开源书籍、大厂开源项目等&#xff0c;涵盖多种编程语言 Python、…

LeetCode - #124 二叉树中的最大路径和(Top 100)

文章目录 前言1. 描述2. 示例3. 答案关于我们前言 本题为 LeetCode 前 100 高频题 我们社区陆续会将顾毅(Netflix 增长黑客,《iOS 面试之道》作者,ACE 职业健身教练。)的 Swift 算法题题解整理为文字版以方便大家学习与阅读。 LeetCode 算法到目前我们已经更新到 123 期…

Electron 隐藏顶部菜单

隐藏前&#xff1a; 隐藏后&#xff1a; 具体设置代码&#xff1a; 在 main.js 中加入这行即可&#xff1a; // 导入模块 const { app, BrowserWindow ,Menu } require(electron) const path require(path)// 创建主窗口 const createWindow () > {const mainWindow ne…

Qemu开发ARM篇-6、emmc/SD卡AB分区镜像制作并通过uboot进行挂载启动

文章目录 1、AB分区镜像制作2、uboot修改3、镜像启动 在上一篇 Qemu开发ARM篇-5、buildroot制作根文件系统并挂载启动中&#xff0c;我们通过buildroot制作了根文件系统&#xff0c;并通过 SD卡的形式将其挂载到设备并成功进行了启动&#xff0c;但上一章中&#xff0c;我们的…

启动 Ntopng 服务前需先启动 redis 服务及 Ntopng 常用参数介绍

启动Ntopng服务之前需要先启动redis服务&#xff0c;因为Ntopng服务依赖于redis服务的键值存储。 服务重启 服务启动 Ntopng常用参数&#xff1a; -d 将 Ntopng 进程放入后台执行。默认情况下&#xff0c;Ntop 在前台运行。 -u 指定启动Ntopng执行的用户&#xff0c;默认为…

[论文精读]TorWard: Discovery, Blocking, and Traceback of Malicious Traffic Over Tor

期刊名称&#xff1a;IEEE Transactions on Information Forensics and Security 发布链接&#xff1a;TorWard: Discovery, Blocking, and Traceback of Malicious Traffic Over Tor | IEEE Journals & Magazine | IEEE Xplore 中文译名&#xff1a;TorWard&#xff1a;…

2024大二上js高级+ES6学习9.26(闭包,递归函数)

9.26.2024 1.闭包 什么是闭包&#xff1a; 闭包的作用&#xff1a; Return 的函数作为fn的子函数&#xff0c;可以使用fn的局部变量num&#xff0c;局部变量num要等所有使用它的函数调用完毕后才销毁 2.闭包的案例 点击li会发现输出4 在 JavaScript 中&#xff0c;事件处理器&…

C语言 | Leetcode C语言题解之第443题压缩字符串

题目&#xff1a; 题解&#xff1a; void swap(char *a, char *b) {char t *a;*a *b, *b t; }void reverse(char *a, char *b) {while (a < b) {swap(a, --b);} }int compress(char *chars, int charsSize) {int write 0, left 0;for (int read 0; read < charsSi…

软考论文《论模型驱动架构设计方法及其应用》精选试读

论文真题 模型驱动架构设计是一种用于应用系统开发的软件设计方法&#xff0c;以模型构造、模型转换和精化为核心&#xff0c;提供了一套软件设计的指导规范。在模型驱动架构环境下&#xff0c;通过创建出机器可读和高度抽象的模型实现对不同问题域的描述&#xff0c;这些模型…

【HTTP(3)】(状态码,https)

【认识状态码】 状态码最重要的目的&#xff0c;就是反馈给浏览器:这次请求是否成功&#xff0c;若失败&#xff0c;则出现失败原因 常见状态码: 200:OK&#xff0c;表示成功 404:Not Found&#xff0c;浏览器访问的资源在服务器上没有找到 403:Forbidden&#xff0c;访问被…

你还在用Java8吗?

Java 11 在企业中&#xff0c;Java的不同版本使用情况随着时间在不断变化。根据最新的数据报告&#xff0c;以下是一些关键点&#xff1a; Java 11 和 Java 17 成为企业中最常用的长期支持&#xff08;LTS&#xff09;版本&#xff0c;使用率分别为 48% 和 45%&#xff0c;而 …

rtp协议:rtp固定头部介绍

前言&#xff1a; 大家好&#xff0c;今天开始给大家分享rtp协议的相关详细介绍&#xff0c;关于rtsp的介绍&#xff0c;大家可以暂时看官方的文档&#xff1a; https://datatracker.ietf.org/doc/html/rfc2326 本文主要是介绍rtp协议&#xff0c;也就是在开发rtsp过程进行传输…

微积分-反函数6.3(对数函数)

如果 b > 0 b > 0 b>0 且 b ≠ 1 b \neq 1 b1&#xff0c;则指数函数 f ( x ) b x f(x) b^x f(x)bx 不是递增就是递减&#xff0c;因此它是通过水平线测试的单调函数。所以它具有反函数 f − 1 f^{-1} f−1&#xff0c;称为以 b b b 为底的对数函数&#xff…

【数据结构】链表(2)

【LinkedList的模拟实现】 这是java中的一个集合类&#xff0c;可以当成链表来使用&#xff0c;作为链表时&#xff0c;它视为包含三个域&#xff0c;是一个双向链表 【构建LinkedList框架】 public class MyLinkedList {static class ListNode{public int val;public ListNo…