From 23d52a80dae7c95ca366a88b647d74352dea045c Mon Sep 17 00:00:00 2001 From: W1CDN Date: Tue, 11 Apr 2023 20:52:59 -0500 Subject: [PATCH] Set up to run waitress in screen if needed. --- api_app.py | 4 ++-- start_api_waitress.py => api_waitress.py | 2 +- start-aprs_api.sh | 4 ++++ 3 files changed, 7 insertions(+), 3 deletions(-) rename start_api_waitress.py => api_waitress.py (90%) create mode 100644 start-aprs_api.sh diff --git a/api_app.py b/api_app.py index a672b68..69e9ccf 100644 --- a/api_app.py +++ b/api_app.py @@ -40,7 +40,7 @@ def read_logs(log_folder): item['station_lat'] = config['Settings']['station_lat'] item['station_lon'] = config['Settings']['station_lon'] - return(json_array) + return(json_array) class Packets(Resource): def get(self): @@ -55,4 +55,4 @@ data = read_logs(log_folder) api.add_resource(Packets, '/packets') # and '/locations' is our entry point for Locations if __name__ == '__main__': - api_app.run(debug=True, host='0.0.0.0') # run our Flask app + api_app.run(debug=True, host='0.0.0.0', port=5001) # run our Flask app diff --git a/start_api_waitress.py b/api_waitress.py similarity index 90% rename from start_api_waitress.py rename to api_waitress.py index 2922193..015c602 100644 --- a/start_api_waitress.py +++ b/api_waitress.py @@ -9,4 +9,4 @@ os.chdir(this_files_dir) # `url_prefix` is optional, but useful if you are serving app on a sub-dir # behind a reverse-proxy. -serve(api_app, host='127.0.0.1', port=5000) +serve(api_app, host='127.0.0.1', port=5001) diff --git a/start-aprs_api.sh b/start-aprs_api.sh new file mode 100644 index 0000000..4199c52 --- /dev/null +++ b/start-aprs_api.sh @@ -0,0 +1,4 @@ +#!/bin/bash +# Run `chmod +x start-aprs_api.sh` so this can be run + +screen -dmS aprs_api python3 /home/pi/aprs_tools/api_waitress.py