2016-12-23 05:00:57 +00:00
|
|
|
from sanic import Sanic
|
2017-05-13 15:01:35 +01:00
|
|
|
from sanic.response import text
|
2016-12-23 05:00:57 +00:00
|
|
|
import logging
|
|
|
|
|
|
|
|
logging_format = "[%(asctime)s] %(process)d-%(levelname)s "
|
|
|
|
logging_format += "%(module)s::%(funcName)s():l%(lineno)d: "
|
|
|
|
logging_format += "%(message)s"
|
|
|
|
|
|
|
|
logging.basicConfig(
|
|
|
|
format=logging_format,
|
|
|
|
level=logging.DEBUG
|
|
|
|
)
|
|
|
|
log = logging.getLogger()
|
|
|
|
|
|
|
|
# Set logger to override default basicConfig
|
2017-01-17 23:38:20 +00:00
|
|
|
sanic = Sanic()
|
2017-05-13 15:01:35 +01:00
|
|
|
|
|
|
|
|
2016-12-23 05:00:57 +00:00
|
|
|
@sanic.route("/")
|
|
|
|
def test(request):
|
|
|
|
log.info("received request; responding with 'hey'")
|
2017-05-13 15:01:35 +01:00
|
|
|
return text("hey")
|
|
|
|
|
2016-12-23 05:00:57 +00:00
|
|
|
|
2017-05-13 15:01:35 +01:00
|
|
|
sanic.run(host="127.0.0.1", port=8000)
|