s/workerclass/worker_class & fix gunicorn django

This commit is contained in:
benoitc 2010-04-22 21:56:37 +02:00
parent 9409839668
commit 40e5751fb7
2 changed files with 7 additions and 5 deletions

View File

@ -33,7 +33,7 @@ def options():
help='Adress to listen on. Ex. 127.0.0.1:8000 or unix:/tmp/gunicorn.sock'), help='Adress to listen on. Ex. 127.0.0.1:8000 or unix:/tmp/gunicorn.sock'),
op.make_option('-w', '--workers', dest='workers', op.make_option('-w', '--workers', dest='workers',
help='Number of workers to spawn. [1]'), help='Number of workers to spawn. [1]'),
op.make_option('-k', '--worker-class', dest='workerclass', op.make_option('-k', '--worker-class', dest='worker_class',
help="The type of request processing to use "+ help="The type of request processing to use "+
"[egg:gunicorn#sync]"), "[egg:gunicorn#sync]"),
op.make_option('-p','--pid', dest='pidfile', op.make_option('-p','--pid', dest='pidfile',
@ -76,7 +76,7 @@ def main(usage, get_app):
else: else:
os.setpgrp() os.setpgrp()
configure_logging(cfg) configure_logging(cfg)
Arbiter(cfg, app).run() Arbiter(cfg, app).run()
def run(): def run():
@ -140,6 +140,8 @@ def run_django():
# django wsgi app # django wsgi app
return django.core.handlers.wsgi.WSGIHandler() return django.core.handlers.wsgi.WSGIHandler()
main("%prog [OPTIONS] [SETTINGS_PATH]", get_app) main("%prog [OPTIONS] [SETTINGS_PATH]", get_app)

View File

@ -15,6 +15,7 @@ from django.utils import translation
from django.core.servers.basehttp import AdminMediaHandler, WSGIServerException from django.core.servers.basehttp import AdminMediaHandler, WSGIServerException
from django.core.handlers.wsgi import WSGIHandler from django.core.handlers.wsgi import WSGIHandler
from gunicorn.arbiter import Arbiter
from gunicorn.config import Config from gunicorn.config import Config
from gunicorn.main import daemonize, configure_logging from gunicorn.main import daemonize, configure_logging
@ -24,7 +25,7 @@ class Command(BaseCommand):
help='Specifies the directory from which to serve admin media.'), help='Specifies the directory from which to serve admin media.'),
make_option('-c', '--config', dest='gconfig', type='string', make_option('-c', '--config', dest='gconfig', type='string',
help='Gunicorn Config file. [%default]'), help='Gunicorn Config file. [%default]'),
make_option('-k', '--worker-class', dest='workerclass', make_option('-k', '--worker-class', dest='worker_class',
help="The type of request processing to use "+ help="The type of request processing to use "+
"[egg:gunicorn#sync]"), "[egg:gunicorn#sync]"),
make_option('-w', '--workers', dest='workers', make_option('-w', '--workers', dest='workers',
@ -72,8 +73,7 @@ class Command(BaseCommand):
try: try:
handler = AdminMediaHandler(WSGIHandler(), admin_media_path) handler = AdminMediaHandler(WSGIHandler(), admin_media_path)
arbiter = conf.arbiter(conf.address, conf.workers, handler, arbiter = Arbiter(conf, handler)
pidfile=conf['pidfile'], config=conf)
if conf['daemon']: if conf['daemon']:
daemonize() daemonize()
else: else: