🏠 Home 🖌 Gallery 💰 Donate 🤝 Frens! rss logo RSS

Happy Birthday Mum (also, I've setup a gallery!)

Published on Monday, 20 September, 2021

On the 16th, one of my favourite people in the world, my mum had her birthday. I used my newly-found interest in drawing to draw her a picture as a gift. I think she liked it and I think she'll like the printed-on-canvas version even more! Once more - happy birthday mum!

On a different note, I've setup a small HTML+CSS gallery. It's incredibly easy to set up with Flask, you just put something akin to

#make gallery with pictures from the drawings folder 
drawings=[] 
directory='static/drawings' 
for filename in os.listdir(directory): 
    drawings.append(filename) 
@app.route('/gallery.html') 
def gallery_page(): 
    return render_template('gallery.hml', drawings=drawings) t

and then I have a gallery.html template that looks like this:

{% extends "base.html" %}
{% block content %}
<main>
</br>
<h1> Gallery </h1>
<center>A simple gallery with all my paintings.</center> </br>
    {% for drawing in drawings %}
    <div class="gallery">
    <a target="_blank" href="static/drawings/{{drawing}}">  
        <img src="/static/drawings/{{drawing}}" alt="{{drawing}}">
    </a>
</div>
{% endfor %}
</main>
{% endblock %}

Now, all I have to do is put a picture in the static/drawings/ directory and run my sitebuilder.py to update the static gallery. It's fairly fast, and incredibly simple to set up, so I urge you to give it a shot on your own website.

And, once again, happy birthday, mum!

~Ivo

theorycorner.com