Create web app blueprint with Flask
This commit is contained in:
parent
a20dab0053
commit
e83f7a0271
|
@ -0,0 +1,8 @@
|
||||||
|
from flask import Flask
|
||||||
|
|
||||||
|
from constants import SECRET_KEY
|
||||||
|
from flask_bootstrap import Bootstrap
|
||||||
|
|
||||||
|
app = Flask(__name__)
|
||||||
|
app.secret_key = SECRET_KEY
|
||||||
|
bootstrap = Bootstrap(app)
|
|
@ -0,0 +1,14 @@
|
||||||
|
from flask import render_template
|
||||||
|
|
||||||
|
from app import app
|
||||||
|
|
||||||
|
|
||||||
|
@app.route("/")
|
||||||
|
@app.route("/index")
|
||||||
|
def index():
|
||||||
|
return render_template("index.html", title="Home Page")
|
||||||
|
|
||||||
|
|
||||||
|
@app.route("/data")
|
||||||
|
def data():
|
||||||
|
return render_template("data.html", title="Data")
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,43 @@
|
||||||
|
{% extends 'bootstrap/base.html' %}
|
||||||
|
|
||||||
|
{% block title %}
|
||||||
|
{% if title %}{{ title }} - graphPaname{% else %}graphPaname{% endif %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block styles %}
|
||||||
|
<link rel="stylesheet"
|
||||||
|
href="{{url_for('.static', filename='bootstrap.min.css')}}">
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block navbar %}
|
||||||
|
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
|
||||||
|
<a class="navbar-brand" href="{{ url_for('index') }}">graphPaname</a>
|
||||||
|
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarColor01" aria-controls="navbarColor01" aria-expanded="false" aria-label="Toggle navigation">
|
||||||
|
<span class="navbar-toggler-icon"></span>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<div class="collapse navbar-collapse" id="navbarColor01">
|
||||||
|
<ul class="navbar-nav mr-auto">
|
||||||
|
<li class="nav-item active">
|
||||||
|
<a class="nav-link" href="{{ url_for('index') }}">Home <span class="sr-only">(current)</span></a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-link"><a href="{{ url_for('data') }}">Data</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<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 #}
|
||||||
|
{% block app_content %}{% endblock %}
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
|
@ -0,0 +1,15 @@
|
||||||
|
{% extends "base.html" %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<h1 class="text-center">How you like your data?</h1>
|
||||||
|
<li>
|
||||||
|
<p class="text-center">
|
||||||
|
<a href="{{ url_for('map_view') }}" class="btn btn-success" role="button" aria-pressed="true">Maps</a>
|
||||||
|
</p>
|
||||||
|
</li>
|
||||||
|
<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 %}
|
|
@ -0,0 +1,8 @@
|
||||||
|
{% extends "base.html" %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="jumbotron">
|
||||||
|
<h1 id="graphPaname">graphPaname</h1>
|
||||||
|
<p>graphPaname is an information system that aims to show real-time data, related to the COVID-19 outbreak, in the city of Paris</p>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
|
@ -38,3 +38,4 @@ COLUMNS = {
|
||||||
"fields.mail",
|
"fields.mail",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
SECRET_KEY = "trolaso"
|
||||||
|
|
Loading…
Reference in New Issue