wsgi 提供的页面不刷新

发布于 2024-09-05 09:50:19 字数 695 浏览 10 评论 0原文

我最近得到了我的第一个应用程序,可以在 uWSGI 中与 Cherokee 一起使用。我使用了以下代码,取自 uWSGI 文档

def application(environ, start_response):
  start_response('200 OK', [('Content-Type', 'text/plain')])
  yield 'Hello World\n'

页面正确读取 你好世界。当我将该文本更改为“New Thing”并刷新时,没有任何变化。我忘记了什么?

我尝试过:

  1. 清除浏览器历史记录和缓存
  2. 停止和启动切诺基


Edit: To clarify, I change Hello World to New Thing in the Python code. Then I stop Cherokee, refresh, and I obviously see an error message. I restart Cherokee, refresh, and I see Hello World.

I recently got my first app to work in uWSGI with Cherokee. I used the following code taken from the uWSGI docs:

def application(environ, start_response):
  start_response('200 OK', [('Content-Type', 'text/plain')])
  yield 'Hello World\n'

The page correctly reads Hello World. When I change that text to New Thing and refresh, nothing changes. What am I forgetting?

What I've tried:

  1. clearing browser history and cache
  2. stopping and starting Cherokee


Edit: To clarify, I change Hello World to New Thing in the Python code. Then I stop Cherokee, refresh, and I obviously see an error message. I restart Cherokee, refresh, and I see Hello World.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

月棠 2024-09-12 09:50:19

因此,其工作方式是 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 更新到您的应用程序更改,无论切诺基如何。

So the way this works is that Cherokee is managing a running uwsgi instance in the back ground for you. What I've noticed so far, and I've not finished looking at, is that if you shut down Cherokee it doesn't seem to also shut down running uwsgi instances.

Try this:

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

So your app code is actually run via uwsgi and Cherokee is more like a proxy server. In order to update the app code you need to send the HUP signal to uwsgi, not Cherkee.

sudo killall -HUP uwsgi

That should cause uwsgi to update to your app changes regardless of Cherokee.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文