You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
822 B
Python

2 years ago
from flask import Flask, render_template, jsonify
import random
from datetime import datetime
import json
import os
app = Flask('app')
# dir_path = os.path.dirname(os.path.realpath(__file__))
# pics_file_path = os.path.join(dir_path,'pics.py')
# metatext_file_path = os.path.join(dir_path,'meta.py')
# os.system(f'python3 {pics_file_path}')
# os.system(f'python3 {metatext_file_path}')
@app.route('/')
def index():
return render_template('index.html')
@app.route('/api/datapoint')
def api_datapoint():
metaDict = open('meta.json',)
meta = json.load(metaDict)
picsDict = open('pics.json',)
pics = json.load(picsDict)
dictionary_to_return = {
'meta': meta,
'pics': pics
}
return jsonify(dictionary_to_return)
app.run(host='0.0.0.0', port=8080, debug=True)