#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed May 20 12:52:00 2026 @author: angoosh """ from flask import Flask, render_template_string, redirect, url_for import sqlite3 app = Flask(__name__) DB_FILE = 'counter.db' def init_db(): """Initialize the database and set the starting number to 0 if it doesn't exist.""" with sqlite3.connect(DB_FILE) as conn: c = conn.cursor() # Create a table to hold our counter c.execute('CREATE TABLE IF NOT EXISTS counter (id INTEGER PRIMARY KEY, value INTEGER)') # Check if the counter row already exists c.execute('SELECT value FROM counter WHERE id = 1') if c.fetchone() is None: # If not, insert the initial value of 0 c.execute('INSERT INTO counter (id, value) VALUES (1, 0)') conn.commit() # HTML & CSS template # The CSS handles making the button blue and centering the layout HTML_TEMPLATE = '''