From 533fc4a9bccaebfcc92f9c91d39755eefe4a8ff7 Mon Sep 17 00:00:00 2001 From: kaiyuran <73236245+kaiyuran@users.noreply.github.com> Date: Tue, 19 Nov 2024 13:21:23 -0500 Subject: [PATCH 1/6] not working --- app.py | 5 ++++- testGet.py | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app.py b/app.py index 2b0acbe..f0a270b 100644 --- a/app.py +++ b/app.py @@ -203,8 +203,11 @@ def emojify(message): app = Flask(__name__) CORS(app) +if __name__ == "__main__": + app.run(port=5000) + # if __name__ == "__main__": -# app.run(port=5500) +# app.run(host='0.0.0.0', port=5501) @app.route('/getemoji', methods=['GET']) # @cross_origin() diff --git a/testGet.py b/testGet.py index 53c168f..214f8c9 100644 --- a/testGet.py +++ b/testGet.py @@ -1,7 +1,7 @@ import requests -url = "http://127.0.0.1:5000/getemoji" - +url = "http://127.0.0.1:5501/getemoji" +# url = "http://37.27.51.34:5501/getemoji" params = { "message": "I love chocolate donuts. I laugh at funny jokes about it. I think it is amazing." } From 0ab36ce8e124110d30d80493ba556bc33559a9c0 Mon Sep 17 00:00:00 2001 From: kaiyuran <73236245+kaiyuran@users.noreply.github.com> Date: Tue, 19 Nov 2024 13:21:37 -0500 Subject: [PATCH 2/6] Revert "not working" This reverts commit 533fc4a9bccaebfcc92f9c91d39755eefe4a8ff7. --- app.py | 5 +---- testGet.py | 4 ++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/app.py b/app.py index f0a270b..2b0acbe 100644 --- a/app.py +++ b/app.py @@ -203,11 +203,8 @@ def emojify(message): app = Flask(__name__) CORS(app) -if __name__ == "__main__": - app.run(port=5000) - # if __name__ == "__main__": -# app.run(host='0.0.0.0', port=5501) +# app.run(port=5500) @app.route('/getemoji', methods=['GET']) # @cross_origin() diff --git a/testGet.py b/testGet.py index 214f8c9..53c168f 100644 --- a/testGet.py +++ b/testGet.py @@ -1,7 +1,7 @@ import requests -url = "http://127.0.0.1:5501/getemoji" -# url = "http://37.27.51.34:5501/getemoji" +url = "http://127.0.0.1:5000/getemoji" + params = { "message": "I love chocolate donuts. I laugh at funny jokes about it. I think it is amazing." } From af4c33a21be5cde89b804a2c0e722e7fa7df32b5 Mon Sep 17 00:00:00 2001 From: kaiyuran <73236245+kaiyuran@users.noreply.github.com> Date: Tue, 19 Nov 2024 13:21:42 -0500 Subject: [PATCH 3/6] Revert "change port" This reverts commit b8abf7f7d07fe43c6f02bd360f57904000b06eea. --- app.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app.py b/app.py index 2b0acbe..8ad838a 100644 --- a/app.py +++ b/app.py @@ -200,11 +200,15 @@ def emojify(message): return final + + + + app = Flask(__name__) CORS(app) -# if __name__ == "__main__": -# app.run(port=5500) +if __name__ == "__main__": + app.run(port=5500) @app.route('/getemoji', methods=['GET']) # @cross_origin() From 66b64f42750cc2eee66efb17348f5eb2118b56cc Mon Sep 17 00:00:00 2001 From: kaiyuran <73236245+kaiyuran@users.noreply.github.com> Date: Tue, 19 Nov 2024 13:21:49 -0500 Subject: [PATCH 4/6] Revert "trying other ports" This reverts commit d0d87613774488f0bb2d377480979b19519f52a7. --- app.py | 3 --- shell.nix | 15 --------------- 2 files changed, 18 deletions(-) delete mode 100644 shell.nix diff --git a/app.py b/app.py index 8ad838a..b8e340c 100644 --- a/app.py +++ b/app.py @@ -207,9 +207,6 @@ def emojify(message): app = Flask(__name__) CORS(app) -if __name__ == "__main__": - app.run(port=5500) - @app.route('/getemoji', methods=['GET']) # @cross_origin() def get_random_emoji(): diff --git a/shell.nix b/shell.nix deleted file mode 100644 index 56d6f2f..0000000 --- a/shell.nix +++ /dev/null @@ -1,15 +0,0 @@ -with import {}; - -mkShell { - buildInputs = [ - python3 - python3Packages.flask - python3Packages.flask-cors - python3Packages.gunicorn - ]; - - shellHook = '' - export LANG=C.UTF-8 - export LC_ALL=C.UTF-8 - ''; -} \ No newline at end of file From 289789326bd3fc23116ee45abda8de8b90040496 Mon Sep 17 00:00:00 2001 From: kaiyuran <73236245+kaiyuran@users.noreply.github.com> Date: Tue, 19 Nov 2024 13:23:30 -0500 Subject: [PATCH 5/6] Revert "add cors" This reverts commit 0d021241156f361c0c46897d660db52207ed5f1e. --- app.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app.py b/app.py index b8e340c..da7e3f9 100644 --- a/app.py +++ b/app.py @@ -1,5 +1,4 @@ from flask import Flask, request, jsonify -from flask_cors import CORS import random def emojify(message): @@ -205,10 +204,9 @@ def emojify(message): app = Flask(__name__) -CORS(app) + @app.route('/getemoji', methods=['GET']) -# @cross_origin() def get_random_emoji(): # Get the 'letter' parameter from the URL message = request.args.get('message') From 8790133b2770aa34c0aadc7f0a6782d8e9a39ffa Mon Sep 17 00:00:00 2001 From: kaiyuran <73236245+kaiyuran@users.noreply.github.com> Date: Tue, 19 Nov 2024 13:24:56 -0500 Subject: [PATCH 6/6] working --- app.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app.py b/app.py index da7e3f9..74b0a03 100644 --- a/app.py +++ b/app.py @@ -1,4 +1,5 @@ from flask import Flask, request, jsonify +from flask_cors import CORS import random def emojify(message): @@ -204,7 +205,7 @@ def emojify(message): app = Flask(__name__) - +CORS(app) @app.route('/getemoji', methods=['GET']) def get_random_emoji():