[Django]gunicorn.errors.HaltServer:

因为是1.3风格的目录结构的django项目,其实用的是django1.6 写法上有点特殊

环境: centos 6.5, python2.6,gunicorn (19.1.1),django1.6


错误为:gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>

这个错误的原因就是命令写法错误,或者是配置文件的错误


正确的写法:

gunicorn  wsgi:application -b 0.0.0.0:8000
gunicorn -b 0.0.0.0:8000 --workers=5 wsgi 
gunicorn -b 0.0.0.0:8000 --workers=5 --log-file error.log wsgi&
这样就可以启动了。

使用配置文件启动:

gunicorn启动一些常用的参数,用配置文件的方式

-c参数: 配置文件

(pyhawk)[root@erya hawk]# cat gun.py 
#coding:utf-8
import multiprocessing 
 
bind = "0.0.0.0:8000"
workers = multiprocessing.cpu_count()*2 + 1

启动:

gunicorn -c gun.py wsgi


gunicorn对django有很好的支持,更多的请参考文档

本文出自 “orangleliu笔记本” 博客,转载请务必保留此出处http://blog.csdn.net/orangleliu/article/details/40895701

作者: orangleliu  

你可能感兴趣的:(django,配置,启动,gunicorn)