Skip to content

Sync django-migrations with the updated tutorial - #836

Open
realpython-bot wants to merge 1 commit into
masterfrom
maintenance/django-migrations-20260916
Open

realpython-bot wants to merge 1 commit into
masterfrom
maintenance/django-migrations-20260916

Conversation

@realpython-bot

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-runNo 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.

…Into Django Migrations

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.

1 participant