Button guide

Run a Python script from an HTML button why the browser can't do it alone, and 4 setups that work, including a ready-made Run form

A plain web page can't start a Python script on a computer by itself; you either run Python inside the browser tab or send the button click to something outside the browser that runs the script. If you just need a web form and a Run button for a script that lives on your computer, Button generates the page for you, runs the job on your machine for up to 30 minutes per run, and is $0 for 1 tool, 3 invited colleagues and 100 runs a month.

Why the browser can't do this alone

When someone opens your web page and clicks a button, the browser's JavaScript is running inside a sandbox. It can't reach out to the computer's operating system and start python my_script.py.

So you have two ways to go. Either you run a browser-compiled version of Python inside the tab itself, or the button sends a request to a program listening outside the browser that starts Python for you. The four setups below cover both.

Setup 1: Host a small Flask endpoint

Flask and FastAPI are Python web frameworks. If you already need your own custom web page and want the button on that exact page to run your code, you put the script behind a route.

  1. Install Flask in your environment:
pip install flask
  1. Write a small server that imports your function and runs it on a POST request:
from flask import Flask, request
import my_script

app = Flask(__name__)

@app.post("/run")
def run_job():
    name = request.form["name"]
    result = my_script.run(name)
    return result
  1. Run the Flask app and point your button at the /run URL.

That gets a button working on your own computer. Serving it to other people means writing the routes and the form, handling file uploads and temporary files, adding a login, running long jobs in the background instead of inside the request, and hosting the app somewhere with HTTPS. If you want full control over the page layout and you're already hosting a Python backend, Flask or FastAPI is the right fit.

Setup 2: PyScript (Python inside the browser)

PyScript runs Python inside the browser tab using Pyodide (CPython compiled to WebAssembly) or MicroPython. There's no server-side Python at all.

Because everything runs in the visitor's tab, PyScript can't start programs on a computer, and it can only reach files on the visitor's device through the file picker or explicit permission in recent Chromium browsers. Your packages also have to be pure-Python wheels or packages prebuilt for Pyodide.

Use PyScript when the script is self-contained, only needs pure-Python or Pyodide-prebuilt packages, and should run in each visitor's own browser with no server. Skip it if the script has to run on your machine or use things installed there.

Setup 3: Self-hosted script runners (Script Server and OliveTin)

If you didn't really want to build a web page from scratch - you only started writing one so people would have a button to click - a self-hosted script runner already has the web UI built in. You install it on a server you manage.

Script Server is an open-source Python web server (Linux first, with a Docker image). Your script's parameters become form fields, including file uploads. It shows live output, offers output files for download, supports LDAP, Google OAuth and htpasswd logins, and keeps execution history and audit logs. Its latest tagged release is 1.18.0 from August 2023, though the main branch still gets commits.

OliveTin is open source, written in Go, and self-hosted only. It gives predefined shell commands from a YAML config a web button, with typed arguments (text, numbers, dropdowns, checkboxes and more), local users, OAuth2 and access control lists. One catch if your script takes files: OliveTin has no file upload argument (feature request #939 has been open since March 2026).

Pick Script Server or OliveTin if you have a Linux server or Docker host you already run and you want to self-host the whole thing under your own logins.

Setup 4: Button (ready-made Run form that runs on your computer)

If the script is on your own macOS, Linux or Windows computer and you want a couple of colleagues to run it without you hosting a server, Button gives the script its own web page with a form and a Run button. Any program works: Python, Node, R, PowerShell, shell scripts, compiled binaries.

Jobs run on your computer, never in Button's cloud, while Button's servers relay the form values and files between the browser and your computer. Because it runs on your machine, your computer has to be on and online when someone uses the tool; tool pages show Ready, Busy or Offline.

Prepare your Python script

Before you hook the script up, make sure it takes its inputs as command-line arguments (argparse in Python, commandArgs() in R, a param() block in PowerShell, $1 and $2 in bash) instead of hard-coded paths or interactive prompts like input(). Take each input file path as an argument, and write the results as files into an output folder that is also passed as an argument:

import argparse
from pathlib import Path

parser = argparse.ArgumentParser()
parser.add_argument("--currency", required=True)
parser.add_argument("source_file")
parser.add_argument("output_dir")
args = parser.parse_args()

out = Path(args.output_dir) / "summary.txt"
out.write_text(f"Processed {args.source_file} in {args.currency}\n")

Fixed flags such as --currency are part of the command you approve; colleagues only supply the values for the form fields.

Put the script on Button

  1. Sign in at button.bitgate.dev and install the Button runner on your computer (macOS, Linux or Windows) with the one-line command the site shows you - curl on macOS and Linux, PowerShell on Windows.
  2. Open the local setup page, pick your program, and describe its inputs (text, number, yes/no, choice, files).
  3. Publish the tool and invite your colleagues.

Colleagues open the link from their invite email, sign in with Google or a one-time email code, fill in the form, press Run and download the results. They install nothing and never pay.

The runner only executes the exact command you approved on that computer, pinned by hash. Every form value is passed to the program as its own argument, with no shell, and a value can't start with "-". If you change a tool, people have to confirm the new version before running it. Every run is logged with who ran it and when, and you can revoke access or set it to expire at any time.

Comparison of the four setups

Option Where Python runs File inputs and outputs Logins included Price
Flask / FastAPI Server you host You code them You code them Free, open source; you pay for hosting
PyScript Visitor's browser (Pyodide or MicroPython) Only files the visitor picks None Free, open source
Script Server Server you host (Linux first, Docker available) File upload fields and output file downloads LDAP, Google OAuth, htpasswd Free, open source; last tagged release August 2023
OliveTin Server you host No file upload argument Local users, OAuth2, ACLs Free, open source
Button Your macOS, Linux or Windows computer Up to 8 files (25 MB each, 100 MB/run); outputs kept 7 days Google or one-time email code Free: $0 (1 tool, 3 people, 100 runs/mo, 1 GB/mo). Pro: $15/mo or $144/yr (50 tools, 250 people, 5,000 runs/mo, 50 GB/mo)

FAQ

Does my computer have to stay on for Button to work?

Yes. Jobs run on your computer rather than in Button's cloud, so your computer has to be on and online when a colleague presses Run, and the tool page shows Ready, Busy or Offline.

What are Button's file and run limits?

Each run can take up to 8 files of up to 25 MB each (100 MB total per run), run for up to 30 minutes, and produce up to 1 MB of logs, with one run at a time per computer. Inputs are deleted 24 hours after a run ends and outputs are deleted after 7 days.

Can I connect more than one computer to my Button workspace?

No, every plan allows one computer (runner) per workspace. Pairing a new computer replaces the previous one.

Do the people I invite have to pay for Button?

Recipients never pay and don't install anything. On the Free plan ($0) you can invite 3 distinct colleagues and run tools 100 times a month (including your own runs); Pro is $15/month, or $144/year ($12/month), for 50 tools, 250 people and 5,000 runs per month, and downgrading deletes nothing.

Last updated

Put your script behind a form

Button turns a script on your computer into a web form. Colleagues sign in, fill it in, press Run and download the results. Free for 1 tool and 3 people.