Django + WSGI:刷新问题? [英] Django + WSGI: Refreshing Issues?

查看:156
本文介绍了Django + WSGI:刷新问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个Django网站。我在现场服务器上进行所有更改,只是因为它更容易。问题是,每一次,似乎都喜欢缓存我正在处理的一个* .py文件。有时如果我刷新了很多,它会在较旧版本的页面和较新版本之间来回切换。



我的设置或多或少是Django教程中介绍的内容如下: http:// docs .djangoproject.com / en / dev / howto / deployment / modwsgi /#howto-deployment-modwsgi



我是猜猜这样做是因为它启动了WSGI处理程序的多个实例,根据http请求发送到哪个处理程序,我可能会收到不同版本的页面。重新启动apache似乎解决了这个问题,但这很烦人。



我真的不太了解WSGI或MiddleWare或任何请求处理的东西。我来自PHP背景,这一切都只是工作:)



无论如何,解决这个问题的好方法是什么?会运行WSGI处理程序是守护进程来缓解问题?如果是这样,我该如何让它运行在守护进程模式?

解决方案

您可以通过不编辑你的代码来解决这个问题实时服务器。认真的,没有任何借口。在本地使用版本控制进行开发,如果必须通过实时检出运行您的服务器,可以使用提交后的挂钩来检查您的最新版本并重新启动Apache。


I'm developing a Django site. I'm making all my changes on the live server, just because it's easier that way. The problem is, every now and then it seems to like to cache one of the *.py files I'm working on. Sometimes if I hit refresh a lot, it will switch back and forth between an older version of the page, and a newer version.

My set up is more or less like what's described in the Django tutorials: http://docs.djangoproject.com/en/dev/howto/deployment/modwsgi/#howto-deployment-modwsgi

I'm guessing it's doing this because it's firing up multiple instances of of the WSGI handler, and depending on which handler the the http request gets sent to, I may receive different versions of the page. Restarting apache seems to fix the problem, but it's annoying.

I really don't know much about WSGI or "MiddleWare" or any of that request handling stuff. I come from a PHP background, where it all just works :)

Anyway, what's a nice way of resolving this issue? Will running the WSGI handler is "daemon mode" alleviate the problem? If so, how do I get it to run in daemon mode?

解决方案

You can resolve this problem by not editing your code on the live server. Seriously, there's no excuse for it. Develop locally using version control, and if you must, run your server from a live checkout, with a post-commit hook that checks out your latest version and restarts Apache.

这篇关于Django + WSGI:刷新问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆