Added a simple data model class to be more flexible. SQLAlchemy will not be included. uplink is to small for this... maybe later. Lot of housekeeping where done too.
This commit is contained in:
parent
4fddd1e7fc
commit
d2f3484ca9
8 changed files with 279 additions and 62 deletions
|
|
@ -31,17 +31,17 @@ logger = getLogger(__name__)
|
|||
class Server:
|
||||
|
||||
def __init__(self, configuration):
|
||||
self.configuration = configuration
|
||||
self.__configuration = configuration
|
||||
|
||||
@route('/hello/<name>')
|
||||
def index(self, name):
|
||||
return template('<b>Hello {{name}}</b>!', name=name)
|
||||
|
||||
@route('/config')
|
||||
def configuration(self):
|
||||
return template('<pre>{{config}}</pre>!', config=json.dumps(vars(self.configuration),
|
||||
def config(self):
|
||||
return template('<pre>{{config}}</pre>!', config=json.dumps(vars(self.__configuration),
|
||||
sort_keys=True, indent=4))
|
||||
|
||||
def run(self):
|
||||
run(host=self.configuration.get_httpserver_host(),
|
||||
port=self.configuration.get_httpserver_port())
|
||||
def run_server(self):
|
||||
run(host=self.__configuration.get_httpserver_host(),
|
||||
port=self.__configuration.get_httpserver_port())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue