mirror of
https://github.com/frappe/gunicorn.git
synced 2026-01-14 11:09:11 +08:00
Start the documentation for the BaseApplication class
This commit is contained in:
parent
a44807f9f5
commit
6211560c47
@ -27,6 +27,9 @@ class BaseApplication(object):
|
|||||||
self.do_load_config()
|
self.do_load_config()
|
||||||
|
|
||||||
def do_load_config(self):
|
def do_load_config(self):
|
||||||
|
"""
|
||||||
|
Loads the configuration
|
||||||
|
"""
|
||||||
try:
|
try:
|
||||||
self.load_default_config()
|
self.load_default_config()
|
||||||
self.load_config()
|
self.load_config()
|
||||||
@ -45,6 +48,14 @@ class BaseApplication(object):
|
|||||||
def load(self):
|
def load(self):
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
def load_config(self):
|
||||||
|
"""
|
||||||
|
This method is used to load the configuration from one or several input(s).
|
||||||
|
Custom Command line, configuration file.
|
||||||
|
You have to override this method in your class.
|
||||||
|
"""
|
||||||
|
raise NotImplementedError
|
||||||
|
|
||||||
def reload(self):
|
def reload(self):
|
||||||
self.do_load_config()
|
self.do_load_config()
|
||||||
if self.cfg.spew:
|
if self.cfg.spew:
|
||||||
@ -65,6 +76,10 @@ class BaseApplication(object):
|
|||||||
|
|
||||||
class Application(BaseApplication):
|
class Application(BaseApplication):
|
||||||
def load_config_from_file(self, filename):
|
def load_config_from_file(self, filename):
|
||||||
|
"""
|
||||||
|
Loads the configuration file: the file is a python file, otherwise raise an RuntimeError
|
||||||
|
Exception or stop the process if the configuration file contains a syntax error.
|
||||||
|
"""
|
||||||
if not os.path.exists(filename):
|
if not os.path.exists(filename):
|
||||||
raise RuntimeError("%r doesn't exist" % filename)
|
raise RuntimeError("%r doesn't exist" % filename)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user