python virtualenv(包装器)+uwsgi+nginx(再次)

2024-10-01 00:20:07 发布

您现在位置:Python中文网/ 问答频道 /正文

好吧,我知道有很多virtualenv + uwsgi + nginx文章,我已经读了大约50篇(我已经完全阅读了uWSGI文档)。在

我的问题:

为什么这些选项都不是我要求它做的虚拟现实?在

[uwsgi]
home = <path to python3 venv>
venv = <path to python3 venv>
virtualenv = <path to python3 venv>

但是,我无法从默认的python2.7启动uwsgi(已安装并正在工作),并让它读取uwsgi.iniactivate和{},然后启动我的django-项目。uwsgi也安装在{}上。在

所有其他的东西都准备好了(用户、组和权限),并且正在工作。在

失败:以激活的novirtualenv开始:

^{pr2}$

成功:激活virtualenv,并开始:

$> workon django
(django) $> uwsgi --ini uwsgi.ini
*** Starting uWSGI 2.0.9 (64bit) on [Fri Feb 13 14:49:42 2015] ***
compiled with version: 4.8.2 on 13 February 2015 06:07:54
os: Linux-3.13.0-43-generic #72-Ubuntu SMP Mon Dec 8 19:35:06 UTC 2014
nodename: intergate.io
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 1
current working directory: /www/django/intergate_io
writing pidfile to /www/django/intergate_io/run/project-master.pid
detected binary path: /opt/vEnvs3/django/bin/uwsgi
chdir() to /www/django/intergate_io
your processes number limit is 3750
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 /www/django/intergate_io/run/socket.sock fd 3
Python version: 3.4.0 (default, Apr 11 2014, 13:08:40)  [GCC 4.8.2]
Set PythonHome to /opt/vEnvs3/django/
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0xe7fc00
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 218280 bytes (213 KB) for 2 cores
*** Operational MODE: preforking ***
WSGI app 0 (mountpoint='') ready in 1 seconds on interpreter 0xe7fc00 pid: 2682 (default app)
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 2682)
spawned uWSGI worker 1 (pid: 2683, cores: 1)
spawned uWSGI worker 2 (pid: 2684, cores: 1)

Tags: topathdjangoioyourvirtualenvvenvis
1条回答
网友
1楼 · 发布于 2024-10-01 00:20:07

在第一种情况下,您似乎正在启动某种全局(可能安装了sudo pip)uwsgi,如输出所示:

detected binary path: /usr/local/bin/uwsgi

它可能缺少python3插件来正确地切换环境,而且总的来说,我发现使用virtualenv的uwsgi总是更简单——它只是工作得更频繁而已。真的,不用费心让整个系统工作,用你自己的吧。您将需要在另一个配置中添加完整路径,但这几乎不是问题。只需启动/path/to/your/venv/bin/uwsgi,而不是uwsgi。在

相关问题 更多 >