import os,random
from flask import Flask, render_template, send_from_directory
from projects import projects_list

app = Flask(__name__)

@app.route("/")
def home():
    bg_files = os.listdir("static/img/backgrounds")
    bg = random.choice(bg_files)
    return render_template("index.html", title="Accueil", background=bg, projects=projects_list[:3])

@app.route("/projects")
def projects():
    return render_template("projects.html", title="Projets", projects=projects_list)
@app.route("/writeups")
def writeups():
    return render_template("writeups.html", title="Writeups")
@app.route("/contact")
def contact():
    return render_template("contact.html", title="Contact")

