Module 10Neill's Vibe · Tier 1 · Basic Vibe Coding~7 min

When you just need a URL that runs your script

Not every idea needs the big rig. Sometimes you want the smallest possible Python server — and that's Flask.

01 · the scene

"I have a working Python script. I just need a URL."

There's a Python function that does the one thing you need — checks a price, formats a report, answers a webhook. It runs fine on your machine. But "runs on my machine" isn't a URL. You don't need React. You don't need a database. You need one address that, when something hits it, runs your function and hands back the answer.

Neill51% · the terrain

"I had a little Python script that worked. I asked how to 'put it online' and the answer was a whole Next.js app, a frontend, a build step. That's a cathedral for a garden shed. I just wanted the script to answer when something called it."

Claude49% · the execution

"Right — wrong-sized tool. When the job is 'one Python function, behind one URL,' you reach for Flask: a few lines turns your script into a tiny web server. No frontend, no heavy framework. The big rig is for when you're building an app, not answering one request."

02 · the why

The minimal Python web server.

Flask is a tiny Python library that turns a function into a web endpoint. You map a URL path to a Python function; when a request comes in for that path, Flask runs the function and sends back whatever it returns. That's the whole idea. A handful of lines gets you a working server — which is exactly why it's the on-ramp: it's the simplest way to put Python behind a URL.

◴

A script behind a URL

the home job

You have a Python function that does one thing. Flask gives it an address so anything — a browser, another program — can call it.

⇄

A webhook receiver

"ping me when…"

Stripe, GitHub, a form — they POST (a way of sending data to a URL) when something happens. Flask is a clean way to catch that and react.

⊞

A tiny API

just the data

Return JSON (a simple text format for data that programs exchange) for another program to use. No pages, no UI — just an endpoint that answers.

When NOT to reach for it: if you're building a real web app — pages people navigate, a polished UI, login, a deploy-ready setup out of the box — that's Next.js, not Flask. Flask is deliberately bare: it doesn't come with a frontend. One more thing to file away: Flask's built-in server (what flask run starts) is a development server. It's perfect for building and testing on your machine; for real traffic you put a production server (like gunicorn) in front later — a routine swap.

03 · predict it

What does @app.route("/") actually do?

Below your import, you write @app.route("/") on the line above a function. Before the reveal — what is that line for?

Not it. Installing happens once with pip; comments start with #; the server starts separately. @app.route(...) is doing something more specific — it's connecting a path to a function.
Exactly. @app.route("/") is a route: it tells Flask "when a request comes in for /, run the function on the next line and send back whatever it returns." Change "/" to "/price" and you've made a different URL. Routes are how one Flask app can answer several addresses.
04 · the walkthrough

The whole server, in one small file.

This is a complete, working Flask app — nothing left out. Reveal it, then watch it run.

◳app.py— the entire server
# app.py — a complete Flask server. This is the whole thing. from flask import Flask app = Flask(__name__) # create the app @app.route("/") # map the home URL "/" ... def home(): # ... to this function return "Hello from Flask!" if __name__ == "__main__": # debug mode stays OFF — debug=True lets anyone who can reach # this server run code. Never enable it for a reachable server. app.run(port=5000) # start the dev server on port 5000

Five real lines of logic. import Flask, make an app, attach the / route to a function, return some text, run. Now the terminal side — two commands. pip install flask to fetch the library (run this inside the virtual environment from the venv lesson — that's exactly what it's for), then start it:

// watch the terminal type itself
terminal — your project folder

flask run and python app.py both start the exact same dev server — they're two doors to one thing. flask run finds your app automatically, while python app.py uses the app.run() line at the bottom. Either way you get a local address: http://127.0.0.1:5000 — that's 127.0.0.1 (your own computer) on port 5000 (a numbered door on your computer). Open it in a browser and your function answers. That's a Python script, behind a URL. (On a Mac, if port 5000 is busy — AirPlay uses it — run flask run --port 5001.)

05 · prove it · gate

Teach it back to unlock the payoff.

Same rule as always: answer it right, or the module isn't done.

In one breath: what is Flask, and when do you reach for it?
// one correct answer unlocks Module 10
Not quite — that's describing a different tool. Flask doesn't ship a frontend, it isn't a database, and it doesn't install anything. Think smaller: one Python function, one URL.
That's it. Flask is the small answer: it puts a Python function behind a URL with almost no ceremony — perfect for a script-behind-a-URL, a webhook, or a tiny API. When the job grows into a real app with pages and a UI, you graduate to Next.js. Right-sized tool for the job. Module unlocked. ↓
the durable idea

Match the tool to the job, not the job to the tool. Flask is the smallest way to put Python behind a URL — reach for it when that's all you actually need.

06 · factory payoff
⊘ locked — pass the teach-back to claim this piece of the factory

Your minimal Flask starter — keep it forever.

A real, runnable app.py — the complete minimal Flask server with a home route and a tiny JSON API route, commented so you can see exactly what each line does — plus a requirements.txt so anyone (or any machine) can install it with one command. Drop it in a folder, pip install -r requirements.txt, flask run, and you have Python behind a URL.

✓ Module 10 complete