Skip to content

Upgrade libraries for Django 4.2 LTS compatibility#4

Open
yuguang wants to merge 1 commit intomasterfrom
upgrade-django-4.2
Open

Upgrade libraries for Django 4.2 LTS compatibility#4
yuguang wants to merge 1 commit intomasterfrom
upgrade-django-4.2

Conversation

@yuguang
Copy link
Owner

@yuguang yuguang commented Mar 9, 2026

Upgrade libraries for Django 4.2 LTS compatibility

This PR upgrades the project from Django 1.4 to Django 4.2 LTS and replaces all deprecated/abandoned libraries.

Dependency changes

Old New
django == 1.4.16 django >= 4.2, < 5.0
django-social-auth >= 0.6.4 social-auth-app-django >= 5.0
django-mediasync >= 2.2.0 django-storages >= 1.14 (mediasync is abandoned)
django-taggit >= 0.9.3 django-taggit >= 5.0
django-chunks >= 0.1 Removed (unmaintained, incompatible)

Code changes

  • manage.py: Replaced execute_manager (removed in Django 1.6) with execute_from_command_line
  • urls.py: Replaced django.conf.urls.defaults / patterns() / url() with django.urls / list syntax / re_path()
  • settings.default.py:
    • Consolidated TEMPLATE_LOADERS, TEMPLATE_CONTEXT_PROCESSORS, TEMPLATE_DIRS → single TEMPLATES dict
    • Renamed MIDDLEWARE_CLASSESMIDDLEWARE
    • Updated context processor paths (django.core.context_processors.*django.template.context_processors.*)
    • Replaced mediasync config with django-storages S3 config
    • Updated social auth: social_authsocial_django, backend paths → social_core.backends.*
    • Added DEFAULT_AUTO_FIELD, removed ADMIN_MEDIA_PREFIX and TEMPLATE_DEBUG
    • Fixed Windows-style path separators (\\) to os.path.join()
  • files.py: Fixed sys.argv[1] crash when imported as a module
  • templates/templates.html: Fixed {% url %} tag to use quoted view name (required since Django 1.5)
  • setup-virtualenv.sh: Replaced external virtualenv download with python3 -m venv

Notes

  • django-chunks was removed from requirements as it is unmaintained and incompatible with modern Django. The {% chunk %} template tags in templates will need a replacement (e.g. django-flatblocks or a custom template tag).
  • The mediasync template tags ({% media_url %}, {% css %}, {% js %}) used in templates will need to be replaced with Django's {% static %} tag or equivalent.

This PR was generated with Oz.

- Update Django from 1.4.16 to 4.2 LTS
- Replace django-social-auth with social-auth-app-django (social_django)
  - Update INSTALLED_APPS: social_auth -> social_django
  - Update AUTHENTICATION_BACKENDS: social_auth.backends.* -> social_core.backends.*
  - Update settings to SOCIAL_AUTH_<PROVIDER>_KEY/SECRET naming convention
- Replace django-mediasync (abandoned) with django-storages for S3 support
- Bump django-taggit to >= 5.0
- Remove django-chunks (unmaintained, incompatible with modern Django)
- Modernize manage.py: replace execute_manager with execute_from_command_line
- Modernize urls.py: replace patterns()/url() with list/re_path()
- Modernize settings.default.py:
  - Replace TEMPLATE_LOADERS/TEMPLATE_CONTEXT_PROCESSORS/TEMPLATE_DIRS with TEMPLATES
  - Replace MIDDLEWARE_CLASSES with MIDDLEWARE
  - Update context processor paths (django.core -> django.template)
  - Remove deprecated ADMIN_MEDIA_PREFIX and TEMPLATE_DEBUG
  - Add DEFAULT_AUTO_FIELD
  - Fix Windows-style path separators
- Fix files.py: handle missing sys.argv gracefully
- Fix template {% url %} tag to use quoted names
- Update setup-virtualenv.sh to use python3 -m venv

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