gpt4 book ai didi

python - 使用 Virtualenv、Circus 和 Chaussette 部署 Django

转载 作者:行者123 更新时间:2023-11-28 22:47:59 25 4
gpt4 key购买 nike

我正在尝试在 CentOS 7 的虚拟主机中使用 Virtualenv、Circus 和 Chaussette 运行 Django,但是当我运行 circusd circus.ini 时我不断收到此错误:

(djenv)[root@localhost django]# circusd circus.ini
2014-09-01 22:06:38 circus[2406] [INFO] Starting master on pid 2406
2014-09-01 22:06:38 circus[2406] [INFO] sockets started
2014-09-01 22:06:38 circus[2406] [WARNING] error in 'settings': [Errno 2] No such file or directory: '~/.virtualenv/djenv/bin/chaussette'
2014-09-01 22:06:38 circus[2406] [WARNING] error in 'settings': [Errno 2] No such file or directory: '~/.virtualenv/djenv/bin/chaussette'
2014-09-01 22:06:38 circus[2406] [WARNING] error in 'settings': [Errno 2] No such file or directory: '~/.virtualenv/djenv/bin/chaussette'
2014-09-01 22:06:38 circus[2406] [WARNING] error in 'settings': [Errno 2] No such file or directory: '~/.virtualenv/djenv/bin/chaussette'
2014-09-01 22:06:38 circus[2406] [WARNING] error in 'settings': [Errno 2] No such file or directory: '~/.virtualenv/djenv/bin/chaussette'
2014-09-01 22:06:38 circus[2406] [INFO] settings stopped
2014-09-01 22:06:38 circus[2406] [INFO] Arbiter now waiting for commands
2014-09-01 22:06:38 circus[2406] [INFO] circusd-stats started
2014-09-01 22:06:38 circus[2415] [INFO] Starting the stats streamer

# Here i close circusd with ctrl+c

2014-09-01 22:19:40 circus[2406] [INFO] Got signal SIG_INT
2014-09-01 22:19:40 circus[2406] [INFO] Arbiter exiting
2014-09-01 22:19:41 circus[2406] [INFO] circusd-stats stopped
Exception ignored in: <module 'threading' from '/usr/local/lib/python3.4/threading.py'>
Traceback (most recent call last):
File "/usr/local/lib/python3.4/threading.py", line 1294, in _shutdown
t.join()
File "/usr/local/lib/python3.4/threading.py", line 1057, in join
raise RuntimeError("cannot join current thread")
RuntimeError: cannot join current thread

我的django项目的路径是/opt/webapps/django/。这是该路径的结构:

(仅供引用:settings 是我给我的 django 项目起的名字)

/django/
/django/manage.py
/django/circus.ini
/django/settings/
/django/settings/urls.py
/django/settings/wsgi.py
/django/settings/settings.py

我的 virtualenv 的路径是:~/.virtualenv/djenv/。这是该路径的结构 (bin):

/djenv/
/djenv/bin/
/djenv/bin/circusd
/djenv/bin/chaussette
/djenv/bin/circushttpd
/djenv/bin/python3.4
/djenv/bin/pip

我的 circus.ini 的内容是:

[circus]
endpoint = tcp://127.0.0.1:5555
pubsub_endpoint = tcp://127.0.0.1:5556
stats_endpoint = tcp://127.0.0.1:5557

[watcher:settings]
cmd = ~/.virtualenv/djenv/bin/chaussette django:/opt/webapps/django --fd $(circus.sockets.settings)$ --django-settings settings.settings
use_sockets = True
numprocesses = 3

[socket:settings]
host = 0.0.0.0
port = 8080

最佳答案

所以我终于找到了解决办法。这是我所做的。

首先,我将 circus.ini 更改为:

[circus]
endpoint = tcp://127.0.0.1:5555
pubsub_endpoint = tcp://127.0.0.1:5556
stats_endpoint = tcp://127.0.0.1:5557

[watcher:settings]
cmd = /root/.virtualenvs/djenv/bin/chaussette settings.wsgi.application
args = --fd $(circus.sockets.settings)
use_sockets = True
numprocesses = 3
copy_env = True
virtualenv = /root/.virtualenvs/djenv/

[socket:settings]
host = 0.0.0.0
port = 8080

因为我在 python 3.4.1 中运行这个马戏团我得到了另一个错误:

OSError: [Errno 9] Bad file descriptor

在寻找此问题的解决方案时,我找到了此修复程序 https://github.com/mozilla-services/circus/pull/800/files

希望这对其他人有帮助。

关于python - 使用 Virtualenv、Circus 和 Chaussette 部署 Django,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25615292/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com