Built for Specialty Retail · Django · Google Drive API · SQLite · Tailwind
Suffolk Coins
The website of a coin dealer, built with Django: a landing page with a banner carousel, a live inventory list taken from a Google Sheet exported as a PDF (cached for five minutes, with the last good copy shown if Google is unreachable), and a contact form whose messages are stored for the owner to read and tick off in an admin. The first version threw every customer message away and called Google on every request; this version fixes both.
Browser → Django Views → Drive Export → PDF Cache

Role
Full-Stack Developer
Duration
Since October 2023
Tech Stack
The Problem
A coin dealer's website has two jobs: show what is in stock, and let a customer ask a question. The first version did neither reliably.
The contact form, headed Live Chat Box, had no action, so a customer's name, phone number and message were thrown away when they pressed Send. The inventory page asked Google Drive for the stock sheet on every visit, with full read and write access to the service account's whole Drive, so each visitor used API quota and waited for Google. The Django secret key and the debug switch were written into the code, the Google service account key was committed, and 191 collected static files were tracked in git.
My Approach
- Contact form. The form now posts to a real endpoint, checks the phone number, is protected against cross-site forgery and has a hidden field that real visitors never see, so a bot that fills it in is answered as if it had worked and nothing is stored. Messages are saved and the owner reads them in the admin, where a Handled box can be ticked in the list.
- Inventory. The Google Sheet is exported once and the PDF is cached for five minutes. If Google fails, the last good copy is shown; if there is none, the visitor gets a plain message. The app asks for read-only Drive access, and the sheet id and key path are configuration, not code.
- Configuration. Everything comes from the environment: the secret key, the allowed hosts and the debug switch (off by default). In production, HTTPS redirect, secure cookies, HSTS and the usual browser headers are on, and the site refuses to start without a secret key.
- Front end. The Tailwind play script and the Alpine.js build that were loaded from other hosts are gone: the stylesheet is compiled to a small committed file and the carousel is a 25-line script that rotates the banners, steps on click, and stands still for visitors who ask for reduced motion.
- Clean-up. A template and a PDF generator that were never used were removed, the project root is no longer a template directory, uploads have a media folder, and the 191 collected static files left git.
- Delivery. One pyproject and lock file for 47 packages, a Dockerfile, a CI workflow, a .env.example that a test keeps complete, and tests for the contact form, the cache, the Drive failure paths and the settings.
Results & Impact
Re-run on 2026-11-14 in a scratch copy: ruff check passes, Bandit reports no findings, makemigrations --check detects no changes, uv audit finds no known vulnerabilities in 46 packages, and 64 tests pass. Two other tests did not pass in that copy because they read the .env.example file, which was not copied there; the repository's own record is 66 passing with 95% coverage.
The real app was also run that day in a browser: the landing page and carousel, a fictional visitor sending a message and getting the confirmation, a bad phone number refused with the form kept as typed, three messages read in the admin with one marked handled, and the inventory route returning a PDF. For that route the Google export was swapped for a synthetic sample list, labelled as sample data, so the page's own view and cache code ran but Google itself was not called. The dealer's name and phone number are masked in every image.
Recorded in the repository's work-done.md (2026-11-02): 17 mutation checks, each putting one defect back and each caught by the tests, among them a wider Drive scope, no cache, no last-good copy, the phone check removed, the hidden field ignored, and debug on by default; and a run on a production Gunicorn server and in a container.
Not verified: the Google export itself against the live account and sheet, a GitHub Actions run, and that the deployed site runs this code.