Wire up the basics
This commit is contained in:
parent
6a7e812a1f
commit
5305b0f49f
1
fabfile.py
vendored
1
fabfile.py
vendored
@ -8,5 +8,6 @@ def hbbs(c):
|
|||||||
"""Release hbbs.decentral1.se."""
|
"""Release hbbs.decentral1.se."""
|
||||||
with c.cd("/var/www/hbbs"):
|
with c.cd("/var/www/hbbs"):
|
||||||
c.run("sudo -su www-data git pull origin master")
|
c.run("sudo -su www-data git pull origin master")
|
||||||
|
c.run("sudo -su www-data .venv/bin/pip install -r requirements.txt")
|
||||||
c.run("sudo supervisorctl restart apps:hbbs")
|
c.run("sudo supervisorctl restart apps:hbbs")
|
||||||
c.run("sudo systemctl reload nginx")
|
c.run("sudo systemctl reload nginx")
|
||||||
|
@ -1,11 +1,46 @@
|
|||||||
"""Flask server."""
|
"""Flask server."""
|
||||||
|
|
||||||
|
from csv import DictReader
|
||||||
|
from os import listdir
|
||||||
|
from os.path import basename, dirname, splitext
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
from flask import Flask, render_template
|
from flask import Flask, render_template
|
||||||
|
from ruamel.yaml import YAML
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
cwd = dirname(Path(__file__).absolute())
|
||||||
|
yaml = YAML()
|
||||||
|
|
||||||
|
|
||||||
@app.route("/")
|
@app.route("/")
|
||||||
def home():
|
def about():
|
||||||
"""Serve the home page."""
|
return render_template("about.html")
|
||||||
return render_template("index.html")
|
|
||||||
|
|
||||||
|
@app.route("/programmes")
|
||||||
|
def programmes():
|
||||||
|
programmes = []
|
||||||
|
path = cwd / Path("static/programmes/")
|
||||||
|
for file in listdir(path):
|
||||||
|
with open(path / file, "r") as handle:
|
||||||
|
contents = handle.read()
|
||||||
|
loaded = yaml.load(contents)
|
||||||
|
programmes.append(loaded)
|
||||||
|
return render_template("programmes.html", programmes=programmes)
|
||||||
|
|
||||||
|
|
||||||
|
@app.route("/collection")
|
||||||
|
def collection():
|
||||||
|
collection = []
|
||||||
|
path = cwd / Path("static/csv/collection.csv")
|
||||||
|
with open(path, "r") as handle:
|
||||||
|
reader = DictReader(handle)
|
||||||
|
for row in reader:
|
||||||
|
collection.append(row)
|
||||||
|
return render_template("collection.html", collection=collection)
|
||||||
|
|
||||||
|
|
||||||
|
@app.route("/participate")
|
||||||
|
def participate():
|
||||||
|
return render_template("participate.html")
|
||||||
|
5
hbbs/static/programmes/point-of-view.yml
Normal file
5
hbbs/static/programmes/point-of-view.yml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
title: Point of View
|
||||||
|
tagline: Perspective makes all the difference
|
||||||
|
films:
|
||||||
|
- Rear Window
|
5
hbbs/static/programmes/retellings.yml
Normal file
5
hbbs/static/programmes/retellings.yml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
title: Retellings
|
||||||
|
tagline: Extending the story with the second film
|
||||||
|
films:
|
||||||
|
- La Jetée & 12 Monkeys
|
@ -1,5 +1,9 @@
|
|||||||
{% extends "layout.html" %}
|
{% extends "layout.html" %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<p>TODO: collection page</p>
|
<ul>
|
||||||
|
{% for film in collection %}
|
||||||
|
<li>{{ film }}</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -14,7 +14,12 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="navigation">
|
<div id="navigation">
|
||||||
<p>TODO:navbar</p>
|
<ul>
|
||||||
|
<li><a href="/">About</a></li>
|
||||||
|
<li><a href="/programmes">Programmes</a></li>
|
||||||
|
<li><a href="/collection">Collection</a></li>
|
||||||
|
<li><a href="/participate">Participate</a></li>
|
||||||
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<div id="content">
|
<div id="content">
|
||||||
{% block content %}{% endblock %}
|
{% block content %}{% endblock %}
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
{% extends "layout.html" %}
|
{% extends "layout.html" %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<p>TODO: programmes page</p>
|
<ul>
|
||||||
|
{% for programme in programmes %}
|
||||||
|
<li>{{ programme }}</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
fabric==2.5.0
|
fabric==2.5.0
|
||||||
flask==1.1.1
|
flask==1.1.1
|
||||||
gunicorn==20.0.4
|
gunicorn==20.0.4
|
||||||
|
ruamel.yaml==0.16.10
|
||||||
|
Loading…
Reference in New Issue
Block a user