eadwinCode/django-ninja-jwt

Django 5.0b1 incompatibility

Closed this issue · 0 comments

  File "/Users/jaddison/projects/myproj/api/project/views/urls.py", line 7, in <module>
    from project.views.api.urls import api
  File "/Users/jaddison/projects/myproj/api/project/views/api/urls.py", line 6, in <module>
    from ninja_jwt.authentication import AsyncJWTAuth
  File "/Users/jaddison/projects/myproj/api/venv/lib/python3.11/site-packages/ninja_jwt/authentication.py", line 12, in <module>
    from .tokens import Token
  File "/Users/jaddison/projects/myproj/api/venv/lib/python3.11/site-packages/ninja_jwt/tokens.py", line 13, in <module>
    from .utils import aware_utcnow, datetime_from_epoch, datetime_to_epoch, format_lazy
  File "/Users/jaddison/projects/myproj/api/venv/lib/python3.11/site-packages/ninja_jwt/utils.py", line 9, in <module>
    from django.utils.timezone import is_naive, make_aware, utc
ImportError: cannot import name 'utc' from 'django.utils.timezone' (/Users/jaddison/projects/myproj/api/venv/lib/python3.11/site-packages/django/utils/timezone.py)

From Django 4.1's release deprecation notes:

The django.utils.timezone.utc alias to datetime.timezone.utc is deprecated. Use datetime.timezone.utc directly.

From Django 5.0's release notes:

The django.utils.timezone.utc alias to datetime.timezone.utc is removed.