mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
"main.py doesn't do anything useful anymore" spotted by @davisp
This commit is contained in:
parent
5b860b532a
commit
c239a3cd88
@ -73,4 +73,12 @@ class DjangoApplicationCommand(Application):
|
|||||||
except (AttributeError, KeyError):
|
except (AttributeError, KeyError):
|
||||||
error_text = str(e)
|
error_text = str(e)
|
||||||
sys.stderr.write(self.style.ERROR("Error: %s" % error_text) + '\n')
|
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()
|
||||||
@ -88,3 +88,25 @@ class PasterServerApplication(Application):
|
|||||||
return self.app
|
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()
|
||||||
@ -23,3 +23,11 @@ class WSGIApplication(Application):
|
|||||||
|
|
||||||
def load(self):
|
def load(self):
|
||||||
return util.import_app(self.app_uri)
|
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()
|
||||||
@ -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()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
8
setup.py
8
setup.py
@ -46,9 +46,9 @@ setup(
|
|||||||
entry_points="""
|
entry_points="""
|
||||||
|
|
||||||
[console_scripts]
|
[console_scripts]
|
||||||
gunicorn=gunicorn.main:run
|
gunicorn=gunicorn.app.wsgiapp:run
|
||||||
gunicorn_django=gunicorn.main:run_django
|
gunicorn_django=gunicorn.app.djangoapp:run
|
||||||
gunicorn_paster=gunicorn.main:run_paster
|
gunicorn_paster=gunicorn.app.pasterapp:run
|
||||||
|
|
||||||
[gunicorn.workers]
|
[gunicorn.workers]
|
||||||
sync=gunicorn.workers.sync:SyncWorker
|
sync=gunicorn.workers.sync:SyncWorker
|
||||||
@ -57,7 +57,7 @@ setup(
|
|||||||
tornado=gunicorn.workers.gtornado:TornadoWorker
|
tornado=gunicorn.workers.gtornado:TornadoWorker
|
||||||
|
|
||||||
[paste.server_runner]
|
[paste.server_runner]
|
||||||
main=gunicorn.main:paste_server
|
main=gunicorn.app.pasterapp:paste_server
|
||||||
""",
|
""",
|
||||||
test_suite = 'nose.collector',
|
test_suite = 'nose.collector',
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user