Skip to content

Commit

Permalink
"main.py doesn't do anything useful anymore" spotted by @davisp
Browse files Browse the repository at this point in the history
  • Loading branch information
benoitc committed Jun 10, 2010
1 parent 5b860b5 commit c239a3c
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 52 deletions.
10 changes: 9 additions & 1 deletion gunicorn/app/djangoapp.py
Expand Up @@ -73,4 +73,12 @@ def load(self):
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()
22 changes: 22 additions & 0 deletions gunicorn/app/pasterapp.py
Expand Up @@ -88,3 +88,25 @@ def load(self):
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()
8 changes: 8 additions & 0 deletions gunicorn/app/wsgiapp.py
Expand Up @@ -23,3 +23,11 @@ def init(self, parser, opts, args):

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()
47 changes: 0 additions & 47 deletions gunicorn/main.py

This file was deleted.

8 changes: 4 additions & 4 deletions setup.py
Expand Up @@ -46,9 +46,9 @@
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
Expand All @@ -57,7 +57,7 @@
tornado=gunicorn.workers.gtornado:TornadoWorker
[paste.server_runner]
main=gunicorn.main:paste_server
main=gunicorn.app.pasterapp:paste_server
""",
test_suite = 'nose.collector',
)

0 comments on commit c239a3c

Please sign in to comment.