2016-12-23 05:00:57 +00:00
|
|
|
import logging
|
|
|
|
|
2021-03-10 09:19:38 +00:00
|
|
|
from sanic import Sanic, text
|
|
|
|
|
2016-12-23 05:00:57 +00:00
|
|
|
logging_format = "[%(asctime)s] %(process)d-%(levelname)s "
|
|
|
|
logging_format += "%(module)s::%(funcName)s():l%(lineno)d: "
|
|
|
|
logging_format += "%(message)s"
|
|
|
|
|
2021-03-10 09:19:38 +00:00
|
|
|
logging.basicConfig(format=logging_format, level=logging.DEBUG)
|
2016-12-23 05:00:57 +00:00
|
|
|
log = logging.getLogger()
|
|
|
|
|
|
|
|
# Set logger to override default basicConfig
|
2021-03-10 09:19:38 +00:00
|
|
|
app = Sanic("app")
|
2017-06-01 19:53:05 +01:00
|
|
|
|
|
|
|
|
2021-03-10 09:19:38 +00:00
|
|
|
@app.route("/")
|
2016-12-23 05:00:57 +00:00
|
|
|
def test(request):
|
|
|
|
log.info("received request; responding with 'hey'")
|
2021-03-10 09:19:38 +00:00
|
|
|
return text("hey")
|
|
|
|
|
2016-12-23 05:00:57 +00:00
|
|
|
|
2023-07-05 11:45:08 +01:00
|
|
|
if __name__ == "__main__":
|
|
|
|
app.run(host="0.0.0.0", port=8000)
|