changed restart_this_app to display html with data from json
This commit is contained in:
parent
f11ee9f51b
commit
5f47adf1e8
2
app.py
2
app.py
@ -12,7 +12,7 @@ def webhook():
|
|||||||
subprocess.run(['git', 'pull'])
|
subprocess.run(['git', 'pull'])
|
||||||
|
|
||||||
# Restart the example_app
|
# Restart the example_app
|
||||||
subprocess.run(['systemctl', 'stop', 'restart_this_app.service'])
|
subprocess.run(['systemctl', 'restart', 'restart_this_app.service'])
|
||||||
|
|
||||||
return 'Success!', 200
|
return 'Success!', 200
|
||||||
else:
|
else:
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
from flask import Flask, request
|
from flask import Flask, render_template
|
||||||
import json
|
import json
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
@app.route('/restart-this-app')
|
@app.route('/restart-this-app')
|
||||||
def funky_function():
|
def render_message():
|
||||||
data = { 'message': "Joe mama" }
|
with open('data.json', encoding='UTF-8') as file:
|
||||||
response = json.dumps(data)
|
data = json.load(file)
|
||||||
|
|
||||||
return response, 200, { 'Content-Type': 'application/json' }
|
return render_template('index.html', data=data)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
app.run(host='0.0.0.0', port=5002)
|
app.run(host='0.0.0.0', port=5002)
|
17
templates/index.html
Normal file
17
templates/index.html
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Recipe</title>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<h1>{{ data.text }}</h1>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
Loading…
Reference in New Issue
Block a user