我使用websockets庫(gevent-socketio)編寫了一個Django應用程序,並使用buildout構建了一個虛擬環境。目前,對於服務我有一個自定義命令,它構造了SocketIOServer類,就像here [1]。正如它在文檔中所說的那樣用gunicorn來做並不是一件困難的事情。用gunicorn部署Django並擴建
因此,我想使用gunicorn作爲服務器,我的問題是關於在buildout.cfg中包含gunicorn,爲了當gunicorn啓動時,它開始於virtualenv(PYTHONPATH)中存在的所有模塊。
是否有可以在./bin/下創建二進制文件的gunicorn配方?我還沒有找到關於build + 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
我看見一個[blog post](http://bluedynamics.com/articles/jens/repoze.bfg-gunicorn-zc.buildout),它建立了gunicorn,這有幫助嗎? –
是的,謝謝! – jam
指向博客帖子的鏈接不再有效......但對解決方案非常感興趣,請您在此添加它作爲答案,並接受您自己的答案嗎?提前致謝。 –