Python的Web应用程序:如何保持状态 [英] Python web application: How to keep state
问题描述
我写了使用web.py在启动过程中加载几十MB的数据到内存中一个WSGI兼容的Web应用程序。
I wrote a WSGI compatible web application using web.py that loads a few dozen MB data into memory during startup.
它的工作原理相当不错的web.py集成的服务器。
It works quite well with the web.py integrated server.
然而,使用Apache 2 + mod_wsgi的,每一个请求重新加载数据,从根本上重新启动该程序。由于几秒钟的加载时间,这是难以承受的。
However, using Apache 2 + mod_wsgi, every single request reloads the data, essentially starting the program again. Due to the loading time of several seconds, this is unbearable.
是不是固有的mod_wsgi还是可以配置?我有什么办法?
Is it inherent to mod_wsgi or can it be configured? What are my alternatives?
推荐答案
是它固有的mod_wsgi?不,这是在HTTP
"Is it inherent to mod_wsgi?" No. It's inherent in HTTP
既然你没有张贴您的mod_wsgi的配置,这是不可能说你做错了什么。
Since you didn't post your mod_wsgi configuration, it's impossible to say what you did wrong.
我只能猜测,你没有使用daemon模式。
I can only guess that you didn't use daemon mode.
请参阅http://$c$c.google.com/p/modwsgi/wiki/ConfigurationGuidelines#Defining_Process_Groups关于守护进程模式的详细信息。
See http://code.google.com/p/modwsgi/wiki/ConfigurationGuidelines#Defining_Process_Groups for more information on daemon mode.
这可能不是最好的解决方案。它可能会更好(远远好)使用正确的数据库。如果没有实际的code的例子,更多的细节,这一切只是猜测随机
This may not be the best solution. It may be better (far, far better) to use a proper database. Without actual code examples, and more details, this is all just random guessing.
这篇关于Python的Web应用程序:如何保持状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!