Skip to content
Snippets Groups Projects
Commit 2ca881a9 authored by dw927's avatar dw927
Browse files

Added logic to populate list of existing reports. Created includes folder to...

Added logic to populate list of existing reports. Created includes folder to hold template components. Added .vscode to gitignore.
parent 70b6e837
Branches
No related tags found
1 merge request!3Connected test_report_provider to fake_model. API now returns proper structure...
venv/
__pycache__
.vscode/
\ No newline at end of file
from flask import Flask, render_template, url_for, flash, redirect
from flask import jsonify
from flask import request
import requests
import urllib.request
......@@ -9,7 +8,9 @@ from werkzeug.utils import secure_filename
app = Flask(__name__)
UPLOAD_FOLDER = 'static/uploads/'
REPORTS_SERVICE_URL = 'http://127.0.0.1:5000'
app.secret_key = "secret key"
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
......@@ -24,6 +25,11 @@ def allowed_file(filename):
def home():
return render_template('home.html')
@app.route('/term2')
def term2():
reports = requests.get(f'{REPORTS_SERVICE_URL}/dpath/report').json()
return render_template('2ndTerm.html', reports=reports)
@app.route('/', methods=['GET', "POST"])
def upload_image():
if 'file' not in request.files:
......@@ -47,3 +53,6 @@ def upload_image():
def display_image(filename):
#print('display_image filename: ' + filename)
return redirect(url_for('static', filename='uploads/' + filename), code=301)
if __name__ == "__main__":
app.run(debug=True)
\ No newline at end of file
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Slide Analyzer</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-Zenh87qX5JnK2Jl0vWa8Ck2rdkQ2Bzep5IDxbcnCeuOxjzrPF/et3URy9Bv1WTRi" crossorigin="anonymous">
</head>
<div class="list-group">
{% include 'includes/reports.html' %}
</div>
<div class="progress w-50">
<div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar" aria-label="Animated striped example" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100" style="width: 75%"></div>
<div class="progress-bar progress-bar-striped progress-bar-animated" role="progressbar"
aria-label="Animated striped example" aria-valuenow="75" aria-valuemin="0" aria-valuemax="100" style="width: 75%">
</div>
</div>
{% if filename %}
......
{% block content %}
<h1>{% block title %} Reports {% endblock %}</h1>
<div class="list-group-item report">
{% for report in reports %}
<div class="d-flex w-100 justify-content-between">
<h5 class="mb-1">{{ report.id }}</h5>
<small>{{ report.report.runDate }}</small>
</div>
{% endfor %}
{% endblock %}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment