import os
from flask import Flask, request, render_template
from datetime import datetime

from werkzeug.exceptions import HTTPException

from app import app
app.config['UPLOAD_FOLDER'] = "uploads/"

@app.errorhandler(400)
def handle_bad_request(e):
    print(f"400 BAD REQUEST: {e}")
    return '400<br>BAD REQUEST'

@app.template_filter('timestamp')
def timestamp_filter(value):
    try:
        dt = datetime.fromtimestamp(value)
        return dt.strftime("%d.%m.%Y %H:%M")
    except:
        return value

# import sendmail
import auth
# import dbcontroll
# import imageupload
import entry

@app.route("/")
def template():
    return render_template("index.html", name="Hmmm")

if __name__ == "__main__":
    app.run(debug=True)
