正在处理的文件已过时/已缓存; Python作为fcgi + web.py + nginx [英] Files being served are stale / cached ; Python as fcgi + web.py + nginx

查看:106
本文介绍了正在处理的文件已过时/已缓存; Python作为fcgi + web.py + nginx的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Nginx和fcgi,python和web.py在ubuntu中提供文件.我的index.py内容是:

I'm serving files in ubuntu using Nginx and fcgi, python and web.py. My index.py contents are:

app = web.application(urls, globals(), True)
if __name__ == "__main__":
    web.wsgi.runwsgi = lambda func, addr=None: web.wsgi.runfcgi(func, addr)
    app.run()

然后我要启动:

spawn-fcgi -n -d /usr/share/nginx/www -f ~/Projects/index.py -a 127.0.0.1 -p 9002

除了我对源文件(index.py或它包含的任何类)进行更改之后,这还可以很好地工作,这些新文件再也不会加载.我必须停止spawn-fcgi并重新启动它才能看到任何更改.这使开发非常麻烦.

Which works fine, EXCEPT, once I make changes to the source files (index.py or any class it includes), those new files are never loaded. I have to stop spawn-fcgi and restart it to see any changes. This make development very cumbersome.

此外,我还关闭了python .pyc/cache文件的生成.

In addition I've turned off the generation of python .pyc/cache files.

TIA

推荐答案

我使用nginx + uwsgi或apache + mod_wsgi部署我的应用程序,如果我touch code.py,它们都会重新加载应用程序.但是我在开发时从集成服务器运行应用程序.

I deploy my apps using nginx+uwsgi or apache+mod_wsgi, both of them reload app if I touch code.py. But I run apps from integrated server when developing.

如果在开发模式下运行具有自己的重新加载器的web.py集成服务器不是一种选择,那么唯一的选择就是编写具有重新加载功能的自己的调度程序.

If running web.py integrated server in development mode that has its own reloader is not an option then the only option is to write your own dispatcher with reload functionality.

这篇关于正在处理的文件已过时/已缓存; Python作为fcgi + web.py + nginx的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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