Skip to content

feat: scaffold Django 5.2 project skeleton (Phase 0)#5

Draft
yuguang wants to merge 6 commits into
masterfrom
modernize/django5
Draft

feat: scaffold Django 5.2 project skeleton (Phase 0)#5
yuguang wants to merge 6 commits into
masterfrom
modernize/django5

Conversation

@yuguang

@yuguang yuguang commented Jun 13, 2026

Copy link
Copy Markdown
Owner

Phase 0: Django 5.2 Project Scaffolding

Replaces the legacy Django 1.4 codebase with a fresh Django 5.2 project skeleton on the modernize/django5 branch.

What's in this PR

New project structure:

  • pythonfiddle_modern/ — Django 5.2 project package (settings, urls, wsgi, asgi)
  • manage.py — replaced with Django 5.2 version
  • requirements.txt — updated with modern deps (replaces mediasync, django-social-auth)
  • .gitignore — excludes .venv, pycache, db.sqlite3
  • docs/modernization/ — PORTED_MODELS.md, DATA_MIGRATION.md, VALIDATION_CHECKLIST.md, old_inspectdb.txt
  • COMPLETION.md — bootstrap commands and handoff notes

Settings configured:

  • whitenoise for static files (replaces mediasync)
  • social_django for OAuth (replaces django-social-auth)
  • django-taggit, cloud_ide.fiddle in INSTALLED_APPS
  • LocaleMiddleware + en/zh LANGUAGES
  • Auth backends: Google OAuth2, Twitter OAuth, Facebook OAuth2

Python 2 → Python 3 / Django 1.4 → 5.2 patches applied to cloud_ide editable install:

  • compression.py: cStringIO → io, reimplemented compress_string
  • models.py: absolute imports, gettext_lazy, reverse(), on_delete, str
  • forms.py, admin.py, views.py, jsonresponse.py: absolute imports, simplejson → json, render_to_response → render, is_ajax() removed
  • templatetags/jqtmpl.py: TokenType enum, TextNode from correct module

Exit Criteria — Passed ✅

  • python manage.py migrate exits 0 (all migrations including fiddle.0001_initial)
  • python manage.py runserver 8001 starts with no ImportError on Django 5.2.15

Conversation: https://app.warp.dev/conversation/20b49f96-beb9-4d1c-9fa1-244195b89cdb
Run: https://oz.warp.dev/runs/019ec33e-63f5-7ad5-829a-fdaca3aa7bed

This PR was generated with Oz.

yuguang and others added 6 commits June 13, 2026 16:19
- 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>
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