A minimal Python web app that exposes a simple HTML form to generate QR codes using the qrencode CLI tool. The app runs an http.server-based HTTP server on port 8000 and returns a PNG image with the generated QR code.
- Simple HTML form at
/to submit text - POST to
/generateto create a QR code - Uses
qrencodeunder the hood - Packaged in a Docker image with
qrencodeinstalled
- Docker
- Docker Compose v2 (usually available as
docker compose)
# From the project root
docker compose up --buildThis will:
- Build the image using the provided
Dockerfile - Start a container named
qrcode-app - Expose the app on
http://localhost:8000
- Open
http://localhost:8000in your browser. - Enter the text you want to encode into the textarea.
- Click Generate QR Code.
- Your browser will display a PNG image containing the QR code.
docker compose downIf you prefer to run the app directly on your host:
- Python 3.12+ (or compatible)
qrencodeinstalled and available inPATH
On Debian/Ubuntu-based systems, you can install qrencode with:
sudo apt-get update && sudo apt-get install -y qrencodepython app.pyThen open http://localhost:8000 in your browser.
app.py— Python HTTP server exposing the QR code form and/generateendpointDockerfile— Builds a minimal image with Python 3.12 andqrencodeinstalleddocker-compose.yml— Orchestrates the app service for local development
- The app listens on
0.0.0.0:8000inside the container. - The Dockerfile is based on
python:3.12-slimand installsqrencodeviaapt.
