apache+mod_wsgi部署quixote的方法
2009-06-19 15:00
363 查看
折腾了好几天,终于搞定,特此记录,如有大牛发现方法有所不妥,请指正一下,不胜感激涕零........
过程如下:
假设python2.5和quixote你已经安装了
1.安装apache2.2 ,过程略
2.下载mod_wsgi.so
3.copy到apache的modlues目录下
4.给quixote准备连接mod_wsgi的脚本,代码如下:
由于qwip需要支持多线程的publisher,所以需要继承publisher实现多线程支持,实现的例子在quixote的demo文件夹中有,代码:
#multi thread support
2import thread
3class ThreadedPublisher (Publisher):
4 is_thread_safe = True
5 def __init__ (self, root_namespace, config=None):
6 Publisher.__init__(self, root_namespace, config)
7 self._request_dict = {}
8 def _set_request(self, request):
9 self._request_dict[thread.get_ident()] = request
def _clear_request(self):
try:
del self._request_dict[thread.get_ident()]
except KeyError:
pass
def get_request(self):
return self._request_dict.get(thread.get_ident())
注意 is_thread_safe = True 这一行是例子中没有的,但是必须加,不然qwip会认为你的publisher不是线程安全的,哪怕你已经做了多线程的处理。
有了这个类之后就简单了,只需要:
def create_publisher():
2 #return Publisher(RootDirectory(),
3 # display_exceptions='plain')
4 return ThreadedPublisher(RootDirectory())
5
6import traceback
7from quixote import get_wsgi_app
8
9try:
pub = create_publisher()
application = get_wsgi_app()
except TypeError,e:
pass
注意application = get_wsgi_app()这个对象名称必须是application,不然mod_wsgi找不到能调用的东西。
5.有了连接的脚本后就只需要配置mod_wsgi就行了
WSGIScriptAlias /test D:/WorkPlace/alex/TestQuixote/wsgi.py
<Directory D:/WorkPlace/alex/TestQuixote/>
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
Allow from all
</Directory>
我这里配置了一个目录,其余的可以举一反三
过程如下:
假设python2.5和quixote你已经安装了
1.安装apache2.2 ,过程略
2.下载mod_wsgi.so
3.copy到apache的modlues目录下
4.给quixote准备连接mod_wsgi的脚本,代码如下:
由于qwip需要支持多线程的publisher,所以需要继承publisher实现多线程支持,实现的例子在quixote的demo文件夹中有,代码:
#multi thread support
2import thread
3class ThreadedPublisher (Publisher):
4 is_thread_safe = True
5 def __init__ (self, root_namespace, config=None):
6 Publisher.__init__(self, root_namespace, config)
7 self._request_dict = {}
8 def _set_request(self, request):
9 self._request_dict[thread.get_ident()] = request
def _clear_request(self):
try:
del self._request_dict[thread.get_ident()]
except KeyError:
pass
def get_request(self):
return self._request_dict.get(thread.get_ident())
注意 is_thread_safe = True 这一行是例子中没有的,但是必须加,不然qwip会认为你的publisher不是线程安全的,哪怕你已经做了多线程的处理。
有了这个类之后就简单了,只需要:
def create_publisher():
2 #return Publisher(RootDirectory(),
3 # display_exceptions='plain')
4 return ThreadedPublisher(RootDirectory())
5
6import traceback
7from quixote import get_wsgi_app
8
9try:
pub = create_publisher()
application = get_wsgi_app()
except TypeError,e:
pass
注意application = get_wsgi_app()这个对象名称必须是application,不然mod_wsgi找不到能调用的东西。
5.有了连接的脚本后就只需要配置mod_wsgi就行了
WSGIScriptAlias /test D:/WorkPlace/alex/TestQuixote/wsgi.py
<Directory D:/WorkPlace/alex/TestQuixote/>
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
Allow from all
</Directory>
我这里配置了一个目录,其余的可以举一反三
相关文章推荐
- django用apache+mod_wsgi部署后中文乱码的解决方法
- ubuntu上Apache+mod_wsgi的Django的部署
- 用Apache+mod_wsgi部署python程序
- ubuntu server 下部署apache+django+mod_wsgi环境
- 用Apache+mod_wsgi部署python程序
- 用Apache+mod_wsgi部署python程序
- 用Apache+mod_wsgi部署python程序 作者:leven | 日期2010-11-29 00:09:37
- flask部署:Apache+mod_wsgi+python+virtualenv
- 通过django-wsgi部署在apache上碰到的问题和解决方法
- Apache+mod_wsgi+flask 在Windows下成功部署!
- 终于搞定flask+win+apache+mod_wsgi+virtualenv的部署发布!!
- Flask + mod_wsgi + Apache on Windows 部署成功(随时接受提问)
- 使用Apache Axis部署 Web服务时的常见问题及其解决方法
- CentOS 7 + Apache + mod_wsgi 部署Django项目
- Apache+wsgi+flask部署
- mod_jk(Apache+mod_jk+tomcat)详细配置方法
- 部署django+apache wsgi
- flask 部署在apache24.* + wsgi 填坑总结
- fedora20 下 django1.6+python3.3 部署到 wsgi 和apache2.4
- 使用Apache Axis部署 Web服务时的常见问题及其解决方法