from flask import Blueprint, render_template, send_from_directory import json from . import dump import os index = ['what-is-a-loot-box', 'crosswords', 'one-sentence-game-ideas', 'nim', 'mimic', 'unfinished-thoughts', 'the-leader', 'connect-less', 'xquisite', 'katamari', 'life-hacks', 'karaoke'] bp = Blueprint( "generate", __name__, url_prefix="/generate", ) @bp.route("/") def blocks(): # temporary, eventually we will dump contents only when they are updated (git hooks + git pull ?) dump.dump(index) with open("postit/contents.json", "r") as f: contributions = json.load(f) return render_template("postit.html", contributions=contributions) @bp.route("/") def block(slug=None): dump.dump([slug]) with open("postit/contents.json", "r") as f: contents = json.load(f) contributions = { slug: contents[slug] } return render_template("postit.html", contributions=contributions)