Skip to content

Sync django-migrations with the updated tutorial - #836

Merged
martin-martin merged 3 commits into
masterfrom
maintenance/django-migrations-20260916
Oct 16, 2026
Merged

martin-martin merged 3 commits into
masterfrom
maintenance/django-migrations-20260916

Conversation

@realpython-bot

@realpython-bot realpython-bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Collaborator

The maintenance update of Digging Deeper Into Django Migrations re-pins the tutorial to Django 6.1 / Python 3.14 and refreshes the 0001_initial.py listing, so the companion project in django-migrations/ needed to catch up. It was still a Django 2.1 / Python 3.6 project, and on Django 6.1 python manage.py makemigrations --check failed, wanting a 0003_alter_pricehistory_id migration the article never shows.

What changed

  • requirements.txt (new) — pinned to the article's dependencies: Django==6.1 plus its resolved deps (asgiref==3.12.1, sqlparse==0.6.0), matching how the other Django folders in this repo pin.
  • README.md — installation now says Python 3.14 / Django 6.1 and installs from requirements.txt instead of pip install "Django==2.*"; the formatting note points at Ruff, which is what this repo runs.
  • historical_data/migrations/0001_initial.py — regenerated on Django 6.1: models.BigAutoField for the implicit primary key, matching the listing in the updated article. This is the change that makes makemigrations --check clean again.
  • historical_data/migrations/0002_switch_to_decimals.py — regenerated on Django 6.1 (content is unchanged apart from the header and generated formatting).
  • manage.py, settings.py, urls.py, wsgi.py, asgi.py — brought up to the Django 6.1 startproject scaffolding: pathlib BASE_DIR, the removed USE_L10N setting dropped, STATIC_URL = "static/", the new MAILERS block, and the docs links repointed from the unsupported /en/2.1/ docs to /en/6.1/ (the same stale-2.1-docs fix the article got). asgi.py was missing and is listed in the project tree of the primer article this project is shared with. The project's original SECRET_KEY and INSTALLED_APPS are kept.
  • db.sqlite3 is deliberately left as shipped: it is the database behind the article's django_migrations table, and running migrate on it applies the three new auth migrations exactly as the updated article describes.

How this was verified

On a fresh Python 3.14.6 virtualenv installed from the new requirements.txt (Django 6.1):

  • python manage.py check — no issues
  • python manage.py makemigrations --check --dry-run — No changes detected (it wanted a new migration before this PR)
  • python manage.py migrate against the shipped db.sqlite3 — applies auth.0010/0011/0012, and a second run prints No migrations to apply., matching the article's opening transcript
  • python manage.py migrate from a deleted database — full run succeeds against the default SQLite backend
  • python manage.py sqlmigrate historical_data 0001 and --backwards — both produce the output the article shows for the backwards case, and the forwards CREATE TABLE matches today's Django
  • python manage.py test, plus importing bitcoin_tracker.wsgi and bitcoin_tracker.asgi
  • Repo gates with the pinned ruff==0.14.1: ruff format --check django-migrations and ruff check django-migrations both pass

Nothing outside django-migrations/ is touched.

Update 2026-10-16

  • This PR also covers Django Migrations: A Primer, whose maintenance update targets the same Django 6.1 project. Its update is booked for 2026-10-18, so this should merge before then.
  • Bumped the pin to Django==6.1.2 (e617709) — the version both updated tutorials were verified against. Re-verified in a fresh Python 3.14 venv from requirements.txt: check clean, all migrations apply (fresh DB and the bundled db.sqlite3), makemigrations --check reports no changes, ruff@0.14.1 format --check and ruff check pass.
  • Supersedes Update django-migrations to Django 6.1 #892 (closed as a duplicate). Reviewed by Martin Breuss.

realpython-bot and others added 2 commits September 16, 2026 14:53
…Into Django Migrations

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
6.1.2 is the current patch release and the version the updated
Django Migrations: A Primer tutorial shows in its install output.
@martin-martin
martin-martin merged commit 3806224 into master Oct 16, 2026
1 check passed
@martin-martin
martin-martin deleted the maintenance/django-migrations-20260916 branch October 16, 2026 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants