mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
detect if debug=true in ini
This commit is contained in:
parent
e830a8f54d
commit
c41b0c6903
@ -29,7 +29,7 @@ import os
|
||||
import pkg_resources
|
||||
import re
|
||||
import sys
|
||||
from paste.deploy import loadapp
|
||||
from paste.deploy import loadapp, loadwsgi
|
||||
from gunicorn.main import main
|
||||
|
||||
__usage__ = "%prog [OPTIONS] APP_MODULE"
|
||||
@ -55,6 +55,13 @@ def get_app(parser, opts, args):
|
||||
|
||||
# add to eggs
|
||||
pkg_resources.working_set.add_entry(relative_to)
|
||||
ctx = loadwsgi.loadcontext(loadwsgi.SERVER, config_url,
|
||||
relative_to=relative_to)
|
||||
debug = ctx.global_conf.get('debug') == "true"
|
||||
if debug:
|
||||
# we force to one worker in debug mode.
|
||||
opts.workers = 1
|
||||
|
||||
app = loadapp(config_url, relative_to=relative_to)
|
||||
return app
|
||||
|
||||
|
||||
@ -4,14 +4,14 @@
|
||||
# The %(here)s variable will be replaced with the parent directory of this file
|
||||
#
|
||||
[DEFAULT]
|
||||
debug = true
|
||||
debug = false
|
||||
# Uncomment and replace with the address which should receive any error reports
|
||||
#email_to = you@yourdomain.com
|
||||
smtp_server = localhost
|
||||
error_email_from = paste@localhost
|
||||
|
||||
[server:main]
|
||||
use = egg:Paste#http
|
||||
use = egg:gunicorn#main
|
||||
host = 127.0.0.1
|
||||
port = 5000
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user