first working flask prototype
This commit is contained in:
18
beertap/__init__.py
Normal file
18
beertap/__init__.py
Normal file
@@ -0,0 +1,18 @@
|
||||
import os
|
||||
|
||||
from flask import Flask
|
||||
|
||||
flask_app_secret = os.environ.get('APP_SECRET', 'changeme')
|
||||
|
||||
def create_app():
|
||||
'''
|
||||
configure the flask app
|
||||
'''
|
||||
app = Flask(__name__)
|
||||
app.config['SECRET_KEY'] = flask_app_secret
|
||||
|
||||
from .views import views
|
||||
|
||||
app.register_blueprint(views, url_prefix='/')
|
||||
|
||||
return app
|
||||
62
beertap/templates/base.html
Normal file
62
beertap/templates/base.html
Normal file
@@ -0,0 +1,62 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"
|
||||
integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh"
|
||||
crossorigin="anonymous"
|
||||
/>
|
||||
<link
|
||||
rel="stylesheet"
|
||||
href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"
|
||||
crossorigin="anonymous"
|
||||
/>
|
||||
|
||||
<title>{% block title %}Base{% endblock %}</title>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
|
||||
<a class="navbar-brand" href="#">Beertap</a>
|
||||
<button
|
||||
class="navbar-toggler"
|
||||
type="button"
|
||||
data-toggle="collapse"
|
||||
data-target="#navbar"
|
||||
>
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbar">
|
||||
<div class="navbar-nav">
|
||||
<a class="nav-item nav-link" id="statistics" href="/statistics">Statistics</a>
|
||||
<a class="nav-item nav-link" id="about" href="/about">About</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="container">
|
||||
{% block content %}
|
||||
{% endblock %}
|
||||
</div>
|
||||
|
||||
<script
|
||||
src="https://code.jquery.com/jquery-3.2.1.slim.min.js"
|
||||
integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<script
|
||||
src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js"
|
||||
integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
<script
|
||||
src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"
|
||||
integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl"
|
||||
crossorigin="anonymous"
|
||||
></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
11
beertap/templates/beertap.html
Normal file
11
beertap/templates/beertap.html
Normal file
@@ -0,0 +1,11 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}Beertap{% endblock %}
|
||||
{% block content %}
|
||||
<form method="POST">
|
||||
<br />
|
||||
<div align="center" class="d-grid gap-2 col-10 mx-auto"">
|
||||
<button type="submit" class="btn btn-primary btn-block py-5">Es Grosses!</button>
|
||||
<button type="submit" class="btn btn-secondary btn-block py-5">Es Chliises!</button>
|
||||
</div>
|
||||
</form>
|
||||
{% endblock %}
|
||||
10
beertap/views.py
Normal file
10
beertap/views.py
Normal file
@@ -0,0 +1,10 @@
|
||||
import json
|
||||
|
||||
from flask import Blueprint, render_template, request, flash, jsonify
|
||||
|
||||
views = Blueprint('views', __name__)
|
||||
|
||||
@views.route('/', methods=['GET', 'POST'])
|
||||
def beer_tap():
|
||||
print("main")
|
||||
return render_template('beertap.html')
|
||||
Reference in New Issue
Block a user