-
Notifications
You must be signed in to change notification settings - Fork 0
/
creator_modified.py
35 lines (28 loc) · 1.1 KB
/
creator_modified.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from flask import Flask, render_template, request, jsonify
import json
exoplanets_container = 'data/cleaned_exoplanet_2.txt'
with open(exoplanets_container, 'r') as file:
exoplanets_json = file.read()
exoplanets = json.loads(exoplanets_json)
app = Flask(__name__)
@app.route('/')
def setup_page():
return render_template('button2.html')
# Exoplanet Blog
@app.route('/exoplanet_catalog')
def exoplanet_catalog():
return render_template('exoplanet.html', exoplanets=exoplanets)
@app.route('/exoplanet/<int:index>')
def show_exoplanet(index):
exoplanet = exoplanets[index]
return render_template('exoplanet_detail.html', exoplanet=exoplanet)
# Exoplanet Blog
@app.route('/dashboard')
def dashboard():
total_exoplanets = 5250
avg_distance = 2164.59
most_recent_year = 2023
oldest_discovery_year = 1992
return render_template('dashboard_with_chartjs.html', exoplanets=exoplanets, total_exoplanets=total_exoplanets, avg_distance=avg_distance, most_recent_year=most_recent_year, oldest_discovery_year=oldest_discovery_year)
if __name__ == '__main__':
app.run(debug=True, port=5009)