mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
close #170 .
add --check-config option to check the config and app loading.
This commit is contained in:
parent
7a1c58f236
commit
cc26270783
@ -144,7 +144,7 @@ tmp_upload_dir = None
|
||||
# Logging
|
||||
#
|
||||
# logfile - The path to a log file to write to.
|
||||
#
|
||||
#
|
||||
# A path string. "-" means log to stdout.
|
||||
#
|
||||
# loglevel - The granularity of log output
|
||||
|
||||
@ -102,6 +102,19 @@ class Application(object):
|
||||
return self.callable
|
||||
|
||||
def run(self):
|
||||
if self.cfg.check_config:
|
||||
try:
|
||||
|
||||
self.load()
|
||||
except:
|
||||
sys.stderr.write("\nError while loading the application:\n\n")
|
||||
traceback.print_exc()
|
||||
|
||||
sys.stderr.flush()
|
||||
sys.exit(1)
|
||||
|
||||
sys.exit(0)
|
||||
|
||||
if self.cfg.spew:
|
||||
debug.spew()
|
||||
if self.cfg.daemon:
|
||||
|
||||
@ -507,6 +507,17 @@ class Spew(Setting):
|
||||
This is the nuclear option.
|
||||
"""
|
||||
|
||||
class ConfigCheck(Setting):
|
||||
name = "check_config"
|
||||
section = "Debugging"
|
||||
cli = ["--check-config",]
|
||||
validator = validate_bool
|
||||
action = "store_true"
|
||||
default = False
|
||||
desc = """\
|
||||
Check the configuration..
|
||||
"""
|
||||
|
||||
class PreloadApp(Setting):
|
||||
name = "preload_app"
|
||||
section = "Server Mechanics"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user