Browse Source

Add a logging line after webserver is started.

Also remove useless `debug` config option.
numerals
Lucas Verney 5 years ago
parent
commit
45c4eca775
  1. 3
      flatisfy/cmds.py
  2. 3
      flatisfy/config.py
  3. 9
      flatisfy/web/app.py

3
flatisfy/cmds.py

@ -234,5 +234,4 @@ def serve(config): @@ -234,5 +234,4 @@ def serve(config):
# standard logging
server = web_app.QuietWSGIRefServer
app.run(host=config["host"], port=config["port"], server=server,
debug=config["debug"])
app.run(host=config["host"], port=config["port"], server=server)

3
flatisfy/config.py

@ -68,8 +68,6 @@ DEFAULT_CONFIG = { @@ -68,8 +68,6 @@ DEFAULT_CONFIG = {
"search_index": None,
# Web app port
"port": 8080,
# Debug mode for webserver
"debug": False,
# Web app host to listen on
"host": "127.0.0.1",
# Web server to use to serve the webapp (see Bottle deployment doc)
@ -133,7 +131,6 @@ def validate_config(config, check_with_data): @@ -133,7 +131,6 @@ def validate_config(config, check_with_data):
assert config["database"] is None or isinstance(config["database"], str) # noqa: E501
assert isinstance(config["debug"], bool)
assert isinstance(config["port"], int)
assert isinstance(config["host"], str)
assert config["webserver"] is None or isinstance(config["webserver"], str) # noqa: E501

9
flatisfy/web/app.py

@ -29,6 +29,13 @@ class QuietWSGIRefServer(bottle.WSGIRefServer): @@ -29,6 +29,13 @@ class QuietWSGIRefServer(bottle.WSGIRefServer):
# pylint: disable=locally-disabled,too-few-public-methods
quiet = True
def run(self, app):
app.log.info(
'Server is now up and ready! Listening on %s:%s.' %
(self.host, self.port)
)
super(QuietWSGIRefServer, self).run(app)
def _serve_static_file(filename):
"""
@ -54,7 +61,7 @@ def get_app(config): @@ -54,7 +61,7 @@ def get_app(config):
app.install(DatabasePlugin(get_session))
app.install(ConfigPlugin(config))
app.config.setdefault("canister.log_level", logging.root.level)
app.config.setdefault("canister.log_path", None)
app.config.setdefault("canister.log_path", False)
app.config.setdefault("canister.debug", False)
app.install(canister.Canister())
# Use DateAwareJSONEncoder to dump JSON strings

Loading…
Cancel
Save