mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
* All configuration and bootup is handled by the Application objects.
* There is now a strict ordering on the precedence of configuration
settings:
1. Each option is given a default value of some sort in options.ini
2. Any detectable framework configuration settings override the hard
coded defaults for options. Currently, only Paster applications
have support for this.
3. Anything that is specified in a Gunicorn configuration file (by
default gunicorn.conf.py) overrides what was possibly set by a
framework specific configuration source.
4. Anything specified on the command line reins supreme. The command
line is the final authority on a given configuration option.
Though, not all configuration options are available via command
line.
* Configuration metadata is pulled from an options.ini. In the future I'll
use this to build the example gunicorn.conf.py and the config.rst file
in docs/site/config.rst.
I haven't tested the differences thoroughly. The next item on my agenda
is to figure out a way to start testing Gunicorn that doesn't make my
eyes bleed.
48 lines
1.2 KiB
Python
48 lines
1.2 KiB
Python
# -*- 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(*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, *args, **kwargs).run()
|
|
|
|
|
|
|
|
|