From c3eefa5c1d83d673d7940f0967b691e4afa70da2 Mon Sep 17 00:00:00 2001 From: Joel Collins Date: Tue, 10 Mar 2020 17:38:44 +0000 Subject: [PATCH] First test of LabThings Gevent-based server --- openflexure_microscope/api/app.py | 9 ++++++++- poetry.lock | 4 ++-- pyproject.toml | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/openflexure_microscope/api/app.py b/openflexure_microscope/api/app.py index e1991132..ef8301b1 100644 --- a/openflexure_microscope/api/app.py +++ b/openflexure_microscope/api/app.py @@ -167,5 +167,12 @@ def cleanup(): atexit.register(cleanup) +# if __name__ == "__main__": +# app.run(host="0.0.0.0", port="5000", threaded=True, debug=True, use_reloader=False) + +# Start the app if __name__ == "__main__": - app.run(host="0.0.0.0", port="5000", threaded=True, debug=True, use_reloader=False) + from labthings.server.wsgi import Server + + server = Server(app) + server.run(host="0.0.0.0", port=5000, debug=True) diff --git a/poetry.lock b/poetry.lock index 07cee8f4..46bd50f4 100644 --- a/poetry.lock +++ b/poetry.lock @@ -281,7 +281,7 @@ marshmallow = "^3.4.0" webargs = "^5.5.3" [package.source] -reference = "028e21cb5b53cc8feeea3af7a0579fde67a54daf" +reference = "2abec0a200e3dbeb8afc8549342328be2357578e" type = "git" url = "https://github.com/labthings/python-labthings.git" [[package]] @@ -700,7 +700,7 @@ version = "1.11.2" rpi = ["picamera", "RPi.GPIO"] [metadata] -content-hash = "ad29f5c7d3a9ac55697f3d74f7b1c992cb2617039cbcab23caa0221f8ed4718a" +content-hash = "4058356cd5db8d9653dd5f7204d691ca07a108936b76136d7332d6eba83029b6" python-versions = "^3.6" [metadata.files] diff --git a/pyproject.toml b/pyproject.toml index ee526317..098a9c85 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,7 +33,7 @@ picamera = { git = "https://github.com/rwb27/picamera.git", branch = "master", o "RPi.GPIO" = { version = "^0.6.5", optional = true } pyserial = "^3.4" # Used for sangaboard (basic_serial_instrument) until we move to sangaboard pip library -labthings = { git = "https://github.com/labthings/python-labthings.git", branch = "master"} # TODO: Pin to a fixed version before 2.0.0 stable +labthings = { git = "https://github.com/labthings/python-labthings.git", branch = "sockets-testing"} # TODO: Pin to a fixed version before 2.0.0 stable python-dateutil = "^2.8" psutil = "^5.6.7" # Autostorage extension