"main.py doesn't do anything useful anymore" spotted by @davisp

This commit is contained in:
benoitc 2010-06-10 17:23:38 +02:00
parent 5b860b532a
commit c239a3cd88
5 changed files with 43 additions and 52 deletions

View File

@ -73,4 +73,12 @@ class DjangoApplicationCommand(Application):
except (AttributeError, KeyError):
error_text = str(e)
sys.stderr.write(self.style.ERROR("Error: %s" % error_text) + '\n')
sys.exit(1)
sys.exit(1)
def run():
"""\
The ``gunicorn_django`` command line runner for launching Django
applications.
"""
from gunicorn.app.djangoapp import DjangoApplication
DjangoApplication("%prog [OPTIONS] [SETTINGS_PATH]").run()

View File

@ -88,3 +88,25 @@ class PasterServerApplication(Application):
return self.app
def run():
"""\
The ``gunicorn_paster`` command for launcing Paster compatible
apllications like Pylons or Turbogears2
"""
from gunicorn.app.pasterapp import PasterApplication
PasterApplication("%prog [OPTIONS] pasteconfig.ini").run()
def paste_server(app, gcfg=None, host="127.0.0.1", port=None, *args, **kwargs):
"""\
A paster server.
Then entry point in your paster ini file should looks like this:
[server:main]
use = egg:gunicorn#main
host = 127.0.0.1
port = 5000
"""
from gunicorn.app.pasterapp import PasterServerApplication
PasterServerApplication(app, gcfg=gcfg, host=host, port=port, *args, **kwargs).run()

View File

@ -23,3 +23,11 @@ class WSGIApplication(Application):
def load(self):
return util.import_app(self.app_uri)
def run():
"""\
The ``gunicorn`` command line runner for launcing Gunicorn with
generic WSGI applications.
"""
from gunicorn.app.wsgiapp import WSGIApplication
WSGIApplication("%prog [OPTIONS] APP_MODULE").run()

View File

@ -1,47 +0,0 @@
# -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
def run():
"""\
The ``gunicorn`` command line runner for launcing Gunicorn with
generic WSGI applications.
"""
from gunicorn.app.wsgiapp import WSGIApplication
WSGIApplication("%prog [OPTIONS] APP_MODULE").run()
def run_django():
"""\
The ``gunicorn_django`` command line runner for launching Django
applications.
"""
from gunicorn.app.djangoapp import DjangoApplication
DjangoApplication("%prog [OPTIONS] [SETTINGS_PATH]").run()
def run_paster():
"""\
The ``gunicorn_paster`` command for launcing Paster compatible
apllications like Pylons or Turbogears2
"""
from gunicorn.app.pasterapp import PasterApplication
PasterApplication("%prog [OPTIONS] pasteconfig.ini").run()
def paste_server(app, gcfg=None, host="127.0.0.1", port=None, *args, **kwargs):
"""\
A paster server.
Then entry point in your paster ini file should looks like this:
[server:main]
use = egg:gunicorn#main
host = 127.0.0.1
port = 5000
"""
from gunicorn.app.pasterapp import PasterServerApplication
PasterServerApplication(app, gcfg=gcfg, host=host, port=port, *args, **kwargs).run()

View File

@ -46,9 +46,9 @@ setup(
entry_points="""
[console_scripts]
gunicorn=gunicorn.main:run
gunicorn_django=gunicorn.main:run_django
gunicorn_paster=gunicorn.main:run_paster
gunicorn=gunicorn.app.wsgiapp:run
gunicorn_django=gunicorn.app.djangoapp:run
gunicorn_paster=gunicorn.app.pasterapp:run
[gunicorn.workers]
sync=gunicorn.workers.sync:SyncWorker
@ -57,7 +57,7 @@ setup(
tornado=gunicorn.workers.gtornado:TornadoWorker
[paste.server_runner]
main=gunicorn.main:paste_server
main=gunicorn.app.pasterapp:paste_server
""",
test_suite = 'nose.collector',
)