繁体   English   中英

用gunicorn和build部署Django

[英]Deploying Django with gunicorn and buildout

我使用websockets库(gevent-socketio)编写了一个Django小应用程序,并使用buildout构建了一个虚拟环境。 目前,为提供服务,我有一个自定义命令,该命令构造SocketIOServer类,就像这里的 [1]一样。 正如文档中所述,用gunicorn做到这一点并不困难。

因此,我想使用gunicorn作为服务器,我的问题是关于在buildout.cfg中包含gunicorn,以便当gunicorn启动时,它从virtualenv(PYTHONPATH)中存在的所有模块开始。

是否有可以在./bin/下创建二进制文件的gunicorn配方? 我还没有找到有关buildout + gunicorn的更多信息。

我的buildout.cfg:

[buildout]
parts = django
newest = false
versions = versions
eggs = django 
         redis 
         gevent 
         gevent-websocket 
         gevent-socketio 
         greenlet 
         django-extensions 
         gunicorn

extensions = mr.developer
auto-checkout = *
sources-dir = external

[sources]
gevent = git git://github.com/gevent/gevent.git
gevent-websocket = hg https://bitbucket.org/Jeffrey/gevent-websocket
gevent-socketio = git git://github.com/abourget/gevent-socketio.git
redis = git https://github.com/andymccurdy/redis-py.git

[versions]
django = 1.4

[django]
recipe = djangorecipe
settings = development
eggs = ${buildout:eggs}
extra-paths = 
project = cacho_site

谢谢!

[1] http://gevent-socketio.readthedocs.org/en/latest/server_integration.html#django-runserver

从2.1.1版开始,您可以创建gunicorn脚本,请参见https://pypi.python.org/pypi/djangorecipe/2.1.1

比起bin / gunicorn和其他参数就可以了。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM