diff --git a/app.py b/app.py index b7bd7ad..7553925 100644 --- a/app.py +++ b/app.py @@ -12,7 +12,7 @@ def webhook(): subprocess.run(['git', 'pull']) # Restart the example_app - subprocess.run(['systemctl', 'stop', 'restart_this_app.service']) + subprocess.run(['systemctl', 'restart', 'restart_this_app.service']) return 'Success!', 200 else: diff --git a/data.json b/data.json new file mode 100644 index 0000000..b799e6d --- /dev/null +++ b/data.json @@ -0,0 +1,3 @@ +{ + "text": "Hello World!" +} \ No newline at end of file diff --git a/restart_this_app.py b/restart_this_app.py index 5e22a92..ea5f2c4 100644 --- a/restart_this_app.py +++ b/restart_this_app.py @@ -1,14 +1,14 @@ -from flask import Flask, request -import json - -app = Flask(__name__) - -@app.route('/restart-this-app') -def funky_function(): - data = { 'message': "Joe mama" } - response = json.dumps(data) - - return response, 200, { 'Content-Type': 'application/json' } - -if __name__ == '__main__': - app.run(host='0.0.0.0', port=5002) +from flask import Flask, render_template +import json + +app = Flask(__name__) + +@app.route('/restart-this-app') +def render_message(): + with open('data.json', encoding='UTF-8') as file: + data = json.load(file) + + return render_template('index.html', data=data) + +if __name__ == '__main__': + app.run(host='0.0.0.0', port=5002) \ No newline at end of file diff --git a/templates/index.html b/templates/index.html new file mode 100644 index 0000000..3c4a297 --- /dev/null +++ b/templates/index.html @@ -0,0 +1,17 @@ + + + + + + + + Recipe + + + + +

{{ data.text }}

+ + + + \ No newline at end of file