题
我最近得到了我的第一个应用程序,可以在 uWSGI 中与 Cherokee 一起使用。我使用了以下代码取自 uWSGI文档:
def application(environ, start_response):
start_response('200 OK', [('Content-Type', 'text/plain')])
yield 'Hello World\n'
页面正确读取 Hello World
. 。当我将该文本更改为 New Thing
并刷新,没有任何变化。我忘记了什么?
我尝试过的:
- 清除浏览器历史记录和缓存
- 停止和启动切诺基
编辑:为了澄清,我改变
Hello World
到 New Thing
在Python代码中。然后我停止 Cherokee,刷新,我显然看到一条错误消息。我重新启动 Cherokee,刷新,我看到了 Hello World
.
解决方案
因此,其工作方式是 Cherokee 在后台为您管理一个正在运行的 uwsgi 实例。到目前为止,我注意到并且尚未完成的研究是,如果您关闭 Cherokee,它似乎不会同时关闭正在运行的 uwsgi 实例。
尝试这个:
sudo service cherokee start
ps aux | grep uwsgi
# you should see nothing from this ps command
# now hit your web app
sudo service cherokee stop
ps aux | grep uwsgi
# you should see the instance of uwsgi that cherokee started
所以你的应用程序代码实际上是通过 uwsgi 运行的,而 Cherokee 更像是一个代理服务器。为了更新应用程序代码,您需要将 HUP 信号发送到 uwsgi,而不是 Cherkee。
sudo killall -HUP uwsgi
这应该会导致 uwsgi 更新到您的应用程序更改,无论切诺基如何。
不隶属于 StackOverflow