Modernize: Django 1.4 → Django 5.2 LTS clean cutover#5
Draft
yuguang wants to merge 9 commits into
Draft
Conversation
- Replace Django 1.4 manage.py with Django 5.2 version - Add pythonfiddle_modern/ project package with settings, urls, wsgi, asgi - Configure settings.py: whitenoise, social_django, taggit, cloud_ide.fiddle, auth backends, i18n (en/zh), LocaleMiddleware, ALLOWED_HOSTS=['*'] for dev - Update requirements.txt: Django>=5.2, social-auth-core, social-auth-app-django, django-taggit, whitenoise (replaces mediasync + django-social-auth) - Add .gitignore (excludes .venv, __pycache__, *.pyc, db.sqlite3) - Add docs/modernization/ with PORTED_MODELS.md, DATA_MIGRATION.md, VALIDATION_CHECKLIST.md, old_inspectdb.txt - Add COMPLETION.md with bootstrap commands and handoff notes Python 2 / Django 1.4 patches applied to cloud_ide (editable install): compression.py, models.py, forms.py, admin.py, views.py, jsonresponse.py, templatetags/jqtmpl.py Exit criteria passed: - python manage.py migrate: OK (fiddle.0001_initial applied) - python manage.py runserver 8001: starts without ImportError on Django 5.2.15 Co-Authored-By: Oz <oz-agent@warp.dev>
- Add STATICFILES_DIRS pointing to project-level static/ directory - Create static/favicon.ico placeholder (16x16 transparent ICO) - STATIC_ROOT, Whitenoise CompressedManifestStaticFilesStorage, and staticfiles/ .gitignore entry were already set by Phase 0 - collectstatic: 128 files copied, 384 post-processed, 0 errors - manage.py check: 0 issues Co-Authored-By: Oz <oz-agent@warp.dev>
Co-Authored-By: Oz <oz-agent@warp.dev>
- scripts/export_legacy_data.py: reads legacy SQLite DB directly (no Django required), dumps Language/Snippet/taggit tables to JSON, decompresses CompressedTextField blobs (gzip → zlib → UTF-8 fallback chain) - scripts/import_legacy_data.py: reads JSON export, get_or_create Language, create Snippet with username-based author lookup (fallback: legacy_import_user), re-applies tags via snippet.tags.set(); logs and counts skipped rows - scripts/README.md: full usage docs including full roundtrip example - docs/modernization/DATA_MIGRATION.md: filled in with actual commands, column-level schema mapping, roundtrip test results, and open issues - .gitignore: exclude legacy_export.json (generated artefact) Roundtrip test passed: 1 Language + 1 Snippet (with 2 tags) exported from db.sqlite3 and re-imported cleanly (0 skipped rows). Co-Authored-By: Oz <oz-agent@warp.dev>
Co-Authored-By: Oz <oz-agent@warp.dev>
- Add social_django.urls at /social-auth/ with namespace='social' - Add TemplateView placeholder at /login/ (Phase 5 supplies real template) - Add LogoutView at /logout/ (POST-only, Django 5 CSRF-safe) - SOCIAL_AUTH_URL_NAMESPACE, env-var OAuth keys, and social_django INSTALLED_APPS / AUTHENTICATION_BACKENDS were already set in settings.py - Document cloud_ide.login as superseded: it uses django-social-auth (removed package), Django 1.4 URL patterns, and render_to_response; do not add to INSTALLED_APPS - All social backend URL reverses verified working - manage.py check: 0 issues Co-Authored-By: Oz <oz-agent@warp.dev>
- Verified cloud_ide.fiddle URL wiring (6 fiddle patterns + i18n) - Confirmed manage.py check passes (0 issues) - Smoke tested views/models/forms imports - Validated Snippet CRUD + CompressedTextField round-trip - Verified URL reverse/resolve for all patterns - Confirmed tag_hint taggit annotate query works Note: cloud_ide/fiddle/urls.py was pre-committed by Phase 0; pythonfiddle_modern/urls.py fiddle include was added by Phase 2. Co-Authored-By: Oz <oz-agent@warp.dev>
- Remove dead mediasync/chunks template tag loads from all templates
- Replace {% css %} with {% static %}, {% media_url %} with {% get_static_prefix %}
- Remove {% chunk %} tags (django-chunks removed)
- All smoke tests passing: HTTP 200 on /, /login/; URL reversal, CRUD, i18n, collectstatic
- VALIDATION_CHECKLIST.md written with cutover runbook
- static/css/, static/images/, static/js/: full set of frontend assets - pythonfiddle_modern/templatetags/chunks.py + mediasync.py: no-op stub template tag libraries replacing dead django-chunks and django-mediasync packages, allowing templates to load without errors - pythonfiddle_modern/settings.py: env-driven CLOUD_IDE_TEMPLATES_DIR and DJANGO_DB_PATH, flatpages in INSTALLED_APPS, correct TEMPLATES DIRS order - run.sh, fetch_static.sh, setup-virtualenv.sh: dev helper scripts - .gitignore: exclude extra venvs and macOS-specific scripts Co-Authored-By: Oz <oz-agent@warp.dev>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Clean cutover from Django 1.4.16 (2012) to Django 5.2.15 LTS on Python 3.14. All dead dependencies replaced. All smoke tests passing.
What Changed
cloud_idepatched for Python 3 compat (7 files)scripts/)django-social-auth→social-auth-app-django(Google/Twitter/Facebook OAuth2)django-mediasync→ Whitenoise; 192 static files managed{% load mediasync %}/{% load chunks %}replaced; stub tag libraries addedRemoved Dependencies
django-mediasync(dead)django-social-auth(dead)django-chunks(dead)Added Dependencies
Django>=5.2social-auth-core+social-auth-app-djangowhitenoisedjango-taggit(kept, updated)Smoke Test Results
Cutover Instructions
See
docs/modernization/VALIDATION_CHECKLIST.mdfor the full data export/import runbook.Before Merging
GOOGLE_KEY,GOOGLE_SECRET,TWITTER_KEY, etc.)Planned and implemented with Oz | Plan
Co-Authored-By: Oz oz-agent@warp.dev