Compare commits

..

No commits in common. "4f5013460f2bd85e8e8f95f8022bf4553e5d82be" and "e83f7a02715819296c6cbc51ef5f2052878e498d" have entirely different histories.

10 changed files with 21 additions and 66 deletions

View File

@ -6,5 +6,3 @@ from flask_bootstrap import Bootstrap
app = Flask(__name__) app = Flask(__name__)
app.secret_key = SECRET_KEY app.secret_key = SECRET_KEY
bootstrap = Bootstrap(app) bootstrap = Bootstrap(app)
from app import errors, routes

View File

@ -1,12 +0,0 @@
from flask import render_template
from app import app
@app.errorhandler(404)
def not_found_error(error):
return render_template("404.html"), 404
@app.errorhandler(500)
def internal_error(error):
return render_template("500.html"), 500

View File

@ -1,9 +0,0 @@
from constants import DATASETS
from flask_wtf import FlaskForm
from wtforms import SelectField, SubmitField
from wtforms.validators import DataRequired
class DatasetForm(FlaskForm):
dataset = SelectField(validators=[DataRequired()], choices=DATASETS)
submit = SubmitField("Submit")

View File

@ -1,7 +1,6 @@
from flask import render_template from flask import render_template
from app import app from app import app
from app.forms import DatasetForm
@app.route("/") @app.route("/")
@ -12,12 +11,4 @@ def index():
@app.route("/data") @app.route("/data")
def data(): def data():
form = DatasetForm() return render_template("data.html", title="Data")
if form.validate_on_submit():
return render_template("visualization.html", form=form, title="Visualization")
return render_template("data.html", title="Data", form=form)
@app.route("/visualization")
def visualization():
return render_template("visualization.html", title="Visualization", form=form)

View File

@ -1,6 +0,0 @@
{% extends "base.html" %}
{% block app_content %}
<h1>Sorry, we couldn't find that</h1>
<p><a href="{{ url_for('index') }}">Back</a></p>
{% endblock %}

View File

@ -1,8 +0,0 @@
{% extends "base.html" %}
{% block app_content %}
<h1>An unexpected error has occurred</h1>
<p>The administrator has been notified!</p>
<p>If he gets too many notifications, we might replace him with an AI</p>
<p><a href="{{ url_for('index') }}">Back</a></p>
{% endblock %}

View File

@ -29,6 +29,14 @@
{% block content %} {% block content %}
<div class="container"> <div class="container">
{% with messages = get_flashed_messages() %}
{% if messages %}
{% for message in messages %}
<div class="alert alert-info" role="alert">{{ message }}</div>
{% endfor %}
{% endif %}
{% endwith %}
{# application content needs to be provided in the app_content block #} {# application content needs to be provided in the app_content block #}
{% block app_content %}{% endblock %} {% block app_content %}{% endblock %}
</div> </div>

View File

@ -1,12 +1,15 @@
{% extends "base.html" %} {% extends "base.html" %}
{% import 'bootstrap/wtf.html' as wtf %}
{% block app_content %} {% block content %}
<h1>Select a dataset</h1> <h1 class="text-center">How you like your data?</h1>
<div class="row"> <li>
<div class="col-md-4"> <p class="text-center">
{{ wtf.quick_form(form) }} <a href="{{ url_for('map_view') }}" class="btn btn-success" role="button" aria-pressed="true">Maps</a>
</div> </p>
</div> </li>
<br> <li>
<p class="text-center">
<a href="{{ url_for('plot_view') }}" class="btn btn-success" role="button" aria-pressed="true">Plots</a>
</p>
</li>
{% endblock %} {% endblock %}

View File

@ -1,9 +0,0 @@
{% extends "base.html" %}
{% import 'bootstrap/wtf.html' as wtf %}
{% block app_content %}
<h1>Dataset visualization</h1>
<img src="data:image/png;base64,{{ plot }}" alt="Image Placeholder">
<img src="data:image/png;base64,{{ map }}" alt="Image Placeholder">
<p><a href="{{ url_for('data') }}">Back</a></p>
{% endblock %}

View File

@ -10,7 +10,6 @@ pkgs.mkShell {
flask flask
flask-bootstrap flask-bootstrap
flask_wtf flask_wtf
matplotlib
folium folium
pytest pytest
# Development tools # Development tools