![](/img/trans.png)
[英]Deploying django app with gunicorn, Importerror in gunicorn log
[英]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.