Files
propedal-planner/app.py
2022-06-12 22:37:36 +02:00

44 lines
985 B
Python

import calendar_interface
import sqlite3
from flask import Flask, render_template, request, url_for, flash, redirect
from werkzeug.exceptions import abort
def get_db_connection():
conn = sqlite3.connect('database.db')
conn.row_factory = sqlite3.Row
return conn
def get_post(post_id):
conn = get_db_connection()
post = conn.execute('SELECT * FROM posts WHERE id = ?',
(post_id,)).fetchone()
conn.close()
if post is None:
abort(404)
return post
app = Flask(__name__)
# app.config['SECRET_KEY'] = 'hello'
@app.route('/')
def index():
events= calendar_interface.get_future_calendar_events().get("value")
calendar_interface.convert_datetimes(events)
if events is None:
abort(404)
else:
return render_template('index.html', events=events)
# @app.route('/<int:event_id>')
# def post(post_id):
# post = get_post(post_id)
# return render_template('show_event.html', post=post)