python - 在 uwsgi 上切换 python 版本

标签 python nginx mod-wsgi uwsgi

我正在使用 nginx 和 uwsgi 运行一个 django 应用程序。它工作正常,但突然间我不知道我更改了什么应用程序停止工作。

问题在于 uWsgi 的 python 版本是 2.4.3,这是 Linux CentOs 中的默认版本,我已经在 2.7.3 版本中安装了 django、webpy 和其他 python 发行版(会尽快升级)

我还尝试在 usr/bin 中创建一个从 python 2.7 路径到“python”的符号链接(symbolic link) 并且没有用。

如何让 uWsgi 使用 python2.7.3(/usr/local/bin/) 而不是 2.4.3?

Django 初始值:

socket = 127.0.0.1:3031
master = true
processes = 4
env = DJANGO_SETTINGS_MODULE=djtest.settings
module = django.core.handlers.wsgi:WSGIHandler()

初始化时

./uwsgi --ini django.ini
[uWSGI] getting INI configuration from django.ini
*** Starting uWSGI 1.3 (64bit) on [Sat Nov 24 00:27:55 2012] ***
compiled with version: 4.1.2 20080704 (Red Hat 4.1.2-52) on 23 November 2012 22:37:39
os: Linux-2.6.18-194.17.4.el5xen #1 SMP Mon Oct 25 16:36:31 EDT 2010
nodename: v238545.hostingator.net
machine: x86_64
clock source: unix
detected number of CPU cores: 1
current working directory: /root
detected binary path: /opt/uwsgi/uwsgi
your processes number limit is 32832
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
uWSGI http bound on :8000 fd 4
spawned uWSGI http 1 (pid: 5841)
uwsgi socket 0 bound to TCP address 127.0.0.1:59395 (port auto-assigned) fd 3
Python version: 2.4.3 (#1, Jun 18 2012, 08:55:23)  [GCC 4.1.2 20080704 (Red Hat 4.1.2-52)]
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0x1cc1130
your server socket listen backlog is limited to 100 connections
mapped 72352 bytes (70 KB) for 1 cores
*** Operational MODE: single process ***
added /usr/local/bin/ to pythonpath.
added /home/indaxone/serv/ to pythonpath.
ImportError: No module named django.core.handlers.wsgi
unable to load app 0 (mountpoint='') (callable not found or import error)
*** no app loaded. going in full dynamic mode ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI worker 1 (and the only) (pid: 5840, cores: 1)

最佳答案

在 uwsgi 安装期间执行“make”之前,我执行了以下操作:

python2.7 uwsgiconfig.py --build

关于python - 在 uwsgi 上切换 python 版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13537373/

相关文章:

python - 用前后的平均值填充包含 NaN 的单元格

ruby-on-rails - 如何强制 nginx 在 HEAD 请求中包含 Content-Length header

ruby - Ubuntu 上的 Nginx 设置

python - 限制wsgi中的系统资源

python - 看到我尝试让 Flask 运行有什么问题了吗? (mod_wsgi + 虚拟环境)

django - WSGIPassAuthorization On 不起作用

python - Virtualenv 使用了错误的 python,即使它位于 $PATH 中的第一个

python - 为什么 python 不能矢量化 map() 或列表理解

node.js - 生产环境中的 Socket.io 和 nginx CORS

python - 安装 gulp-converter-tjs 时找不到 Python 可执行文件