Day 95 of 100 Days Coding Challenge: Python
Today was supposed to be the grand finale. The plan: add a simple authorization system, set up daily backups, and polish everything with a shiny test suite. Instead, one tiny testing error snowballed into a catastrophic app crash. And the punchline? I hadn’t pushed to GitHub in four days. Yes, four.
So there I was, watching my carefully crafted app crumble, muttering at myself for breaking the golden rule: always back up. The irony stung—after weeks of building a timeline of civilizations that fell for ignoring simple rules, I managed to repeat history myself. Turns out, hubris gets you whether you’re Rome or just a tired coder.
Today’s Motivation / Challenge
Why does this matter? Because by the end of any project, you want to know your work isn’t just duct-taped together. Governance, performance, backups—these are the boring but essential pieces that keep your app from toppling like a badly built tower. Think of it like brushing your teeth: not exciting, but skip it, and you’ll regret it.
Purpose of the Code (Object)
The code here ties up loose ends: adding simple password-based access, creating a daily backup script, optimizing database performance with indexes, and ensuring tests cover at least 80% of the data and API. The goal is to make sure the app runs fast, stays secure, and—most importantly—doesn’t collapse when someone sneezes.
AI Prompt
Please do the following:
Governance & perf
- Simple auth (env-guarded)
- Daily backup script
- DB indexes
- Test suite
Accept: tests ≥80% coverage on data + API; timeline loads <250ms on sample set.
Functions & Features
- Add environment-based simple authentication.
- Run a daily script to back up the database.
- Add indexes for faster queries.
- Build a test suite with at least 80% coverage.
Requirements / Setup
You’ll need:
- Python 3.11
Installs:
pip install pytest
Minimal Code Sample
# Simple env-based auth
import os
PASSWORD = os.getenv(“APP_PASSWORD”)
def check_auth(pw):
return pw == PASSWORD
A tiny helper to check passwords against environment variables.
The Civilization Timeline Builder
Notes / Lessons Learned
Creating authorization wasn’t the problem—it was forgetting that I’d hardcoded a password in an .env file ages ago and then promptly lost it. Nothing like digging through old notes trying to remember whether you typed password123 or password_123.
Then came the imports. Every time I messed with data/seeds, my app broke in spectacular fashion. I’ve realized most of my headaches came from database imports, not from the app itself. Lesson? When your project leans heavily on a database, really know how you’re connecting to it. Otherwise, you’ll spend more time fixing imports than writing actual features.
In the end, I didn’t get the clean finale I wanted, but I walked away with the most important reminder of all: always, always back up. Civilization may fall without warning, but your repo doesn’t have to.
Optional Ideas for Expansion
- Add role-based permissions (e.g., read-only vs. admin).
- Automate cloud backups instead of local scripts.
- Track performance metrics over time to catch slowdowns early.

