diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml index 8645353..fb7f4df 100644 --- a/docker-compose.dev.yml +++ b/docker-compose.dev.yml @@ -5,6 +5,6 @@ services: context: . dockerfile: ./Dockerfile.dev ports: - - '7000:7000' + - '10000:7000' volumes: - ./static:/app/templates diff --git a/server.py b/server.py index c20de62..ad3a3bc 100644 --- a/server.py +++ b/server.py @@ -6,12 +6,28 @@ import subprocess import threading import time + from subprocess import Popen, PIPE, STDOUT from sign_message import SignMessage proc = None sign_message = None + +def turnOff(): + global proc + global sign_message + success = False + if args.development: + success = True + sign_message = None + if proc != None: + proc.kill() + sign_message = None + success = True + + + app = Flask(__name__) parser = argparse.ArgumentParser() parser.add_argument( @@ -92,18 +108,13 @@ def random_message(): @app.route("/api/turn-off", methods=["GET"]) def turn_off(): - global proc - global sign_message - success = False - if proc != None: - proc.kill() - sign_message = None - success = True + turnOff() return jsonify({ "success": success }) + @app.route("/api/update-sign", methods=["POST"]) def update_sign(): global proc @@ -129,8 +140,9 @@ def update_sign(): sign_message = None return "Could not update sign", 500 @app.route('/') -def home(): - return render_template('index.html') +def home(): + return render_template('index.html') + if __name__ == "__main__": # give the last opened an initial value of now, diff --git a/static/index.html b/static/index.html index 1137be5..29702df 100644 --- a/static/index.html +++ b/static/index.html @@ -6,6 +6,45 @@ SCE LED Sign -

hello from the sign :D

+ + + + +