Day 33 of 100 days coding challenge: Python
Personal Experience
I’ve been blogging for over six years, but not like this. My usual workflow involves logging into a WordPress site, clicking “New Post,” and typing away like a caffeinated raccoon. No programming. No servers. Definitely no manually structured file trees.
Then yesterday, I discovered Flask—a micro web framework in Python—and I couldn’t resist the “Hello, World” charm offensive. Today, I took it a step further: I built a miniature blog app. Not styled. Not database-backed. But it works. I can write a post, hit submit, and watch it appear like magic (or slightly awkward sorcery). It’s not pretty—yet—but it’s mine. And honestly, playing with this new toy has me feeling like the proud owner of a digital Easy-Bake Oven. You throw in some code, and out pops a web page. Delicious.
Today’s Motivation / Challenge
I’ve used blogs for years, but never thought of building one from the ground up. Today’s challenge wasn’t just about learning Flask—it was about flipping the curtain on the software I use every day. It’s like going from “driving a car” to “building one with duct tape and curiosity.” And you know what? Turns out the engine runs just fine.
Purpose of the Code (Object)
This mini app creates a simple blogging website. You can add a new post, view all existing ones, and pretend—for just a moment—that you’re running your own minimalist content empire. It doesn’t use a database yet—just keeps your posts in memory—but it’s a great stepping stone.
AI Prompt:
Write a simple Flask app that displays blog posts and lets users add a new one through a form. Keep it minimal, with in-memory storage and two HTML templates: one for the homepage and one for the post form.
Functions & Features
- Displays a list of all blog posts
- Lets users create a new blog post via a form
- Stores posts temporarily (in memory)
Requirements / Setup
pip install flask
You’ll need Python 3.6 or later. Then just run app.py and open your browser.
Minimal Code Sample
@app.route(‘/new’, methods=[‘GET’, ‘POST’])
def new_post():
if request.method == ‘POST’:
title = request.form[‘title’]
content = request.form[‘content’]
blog_posts.append({‘title’: title, ‘content’: content})
return redirect(url_for(‘home’))
return render_template(‘new_post.html’)
This route displays a form or saves a post, depending on the request.
Notes / Lessons Learned
When working with Flask, file structure isn’t just a “nice to have”—it’s the entire vibe. The templates folder must be in the exact same level as app.py, or Flask will act like it doesn’t know you. I spent a good hour wondering why my beautiful new form page was blank. A quick “View Page Source” revealed… nothing. That’s when I realized: I hadn’t saved the file. Turns out I’d disabled auto-save in VS Code, and my new_post.html was basically a digital tumbleweed. Once I retyped it, saved everything properly, and restarted the app, the blog sprang to life—albeit looking like a Geocities relic. But I made it. And that’s what counts.
This experience reminded me: fancy tools are fun, but building something with your own code—flaws and all—is a different kind of thrill. I’m starting to see the potential here. Flask is no longer just “that framework with a cool name”—it might be the engine behind my next real web project.
Optional Ideas for Expansion
- Add a timestamp to each post
- Style it with Bootstrap for instant visual credibility
- Save posts to a text file or SQLite database so they don’t disappear on refresh
