Skip to content
Projects

simonw/simonwillisonblog

View on GitHub

About

The source code behind my blog

Web & App Development

How these counts are measured

Measured star growth

in 24h
0
in 7 days
0
in 15 days
0
in 1 month
Collecting history

Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.

README.md

Original

simonwillisonblog

GitHub Actions

The code that runs my weblog, https://simonwillison.net/

Development

Development tasks run through just, which uses uv to manage dependencies. They are declared in pyproject.toml and pinned in uv.lock, and .python-version selects Python 3.13. There is no requirements.txt, and no need to create or activate a virtual environment: the first just command creates .venv and later ones keep it in sync with uv.lock.

You need just, uv, a local PostgreSQL server and a database. The Justfile sets DATABASE_URL to postgres:///simonwillisonblog for you:

createdb simonwillisonblog
just manage migrate

The recipes:

  • just test collects static files, then runs the tests with --keepdb. Extra arguments are passed through, e.g. just test -k test_homepage. Plain just does the same.
  • just server runs the development server with DJANGO_DEBUG=1, e.g. just server 8001.
  • just manage <command> runs any management command, e.g. just manage makemigrations or just manage shell.

There are also some helper scripts:

  • ./runserver.sh runs the development server on 0.0.0.0:8033 using an editable checkout of s3-web-manager-django from ~/dev/s3-web-manager-django in place of the pinned release. It runs in an isolated environment, not .venv, because the pinned copy in .venv would otherwise take precedence.
  • ./claude-run-tests.sh and ./claude-web-test.sh set up PostgreSQL and run the tests in a fresh Linux container, such as Claude Code on the web.

Changing dependencies

uv add some-package          # runtime dependency
uv add --dev some-package    # test or development only
uv lock --upgrade-package django

Commit both pyproject.toml and uv.lock. Heroku installs with uv sync --locked --no-default-groups, so the build fails if uv.lock is out of date, and packages in the dev group are not installed in production. Don't add a requirements.txt: the Heroku build errors if it finds files for more than one package manager.

Search Engine

This blog includes a built-in search engine. Here's how it works:

  1. The search functionality is implemented in the search function in blog/search.py.
  2. It uses a combination of full-text search and tag-based filtering.
  3. The search index is built and updated automatically when new content is added to the blog.
  4. Users can search for content using keywords, which are matched against the full text of blog entries and blogmarks.
  5. The search results are ranked based on relevance and can be further filtered by tags.
  6. The search interface is integrated into the blog's user interface, allowing for a seamless user experience.

For more details on the implementation, refer to the search function in blog/search.py.

S3 Manager

The admin tools include /tools/s3/, backed by s3-web-manager-django, for browsing and uploading files to the configured S3 bucket. S3_WEB_MANAGER_PUBLIC_URL_BASE is set to https://static.simonwillison.net/ so copied and viewed object URLs use the public static host plus the path in the bucket.

Newsletters

/newsletters/ lists the latest ten issues, with archives by year. Substack issues link out; public monthly newsletters have local Markdown pages. Newsletters appear in day and month archives, and public monthly issues are searchable. Edit records at /admin/blog/newsletter/.

Use /admin/importers/ to import:

  • Substack: the latest 20 issues or the complete archive.
  • Public monthly newsletters: content and send dates from monthly-newsletter-archive, fetched over HTTP.
  • Private monthly newsletter: listing metadata and preview headings from simonw-private/monthly, without storing the private body. Requires GH_API_SIMONW_PRIVATE_MONTHLY, a GitHub token with Contents read permission for that repository. Restart the server after setting it.

Keep the importer page open until it finishes. Imports can be repeated without creating duplicates; when a private issue appears in the public archive, its existing record is updated with the public content. Preview headings can be edited in the admin, one heading per line.

Explore related projects

Loading…