From c239a3cd88542c0cab4f35c785d710d38df98216 Mon Sep 17 00:00:00 2001 From: benoitc Date: Thu, 10 Jun 2010 17:23:38 +0200 Subject: [PATCH] "main.py doesn't do anything useful anymore" spotted by @davisp --- gunicorn/app/djangoapp.py | 10 ++++++++- gunicorn/app/pasterapp.py | 22 ++++++++++++++++++ gunicorn/app/wsgiapp.py | 8 +++++++ gunicorn/main.py | 47 --------------------------------------- setup.py | 8 +++---- 5 files changed, 43 insertions(+), 52 deletions(-) delete mode 100644 gunicorn/main.py diff --git a/gunicorn/app/djangoapp.py b/gunicorn/app/djangoapp.py index 03d93eba..18b75332 100644 --- a/gunicorn/app/djangoapp.py +++ b/gunicorn/app/djangoapp.py @@ -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) \ No newline at end of file + 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() \ No newline at end of file diff --git a/gunicorn/app/pasterapp.py b/gunicorn/app/pasterapp.py index 40ee44a6..cd4b1ac2 100644 --- a/gunicorn/app/pasterapp.py +++ b/gunicorn/app/pasterapp.py @@ -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() \ No newline at end of file diff --git a/gunicorn/app/wsgiapp.py b/gunicorn/app/wsgiapp.py index 632fdcf7..99e00258 100644 --- a/gunicorn/app/wsgiapp.py +++ b/gunicorn/app/wsgiapp.py @@ -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() \ No newline at end of file diff --git a/gunicorn/main.py b/gunicorn/main.py deleted file mode 100644 index 533750e6..00000000 --- a/gunicorn/main.py +++ /dev/null @@ -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() - - - - diff --git a/setup.py b/setup.py index 18f16ab4..7f5ba87b 100644 --- a/setup.py +++ b/setup.py @@ -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', )