Django 3.0が予定通りに2019年12月2日にリリースされました。詳しい変更内容は3.0のリリースノートをご参照ください。
3.0はDjangoの既存アーキテクチャに大きく手を入れたというより、近年台頭してきているMariaDB(MySQLから派生した関係データベース)やASGI(WSGIの後継)を正式にサポートするようになったなど守備範囲を広げた印象です。
ちなみにDjango 3.0からPythonのバージョンは3.6以上をサポートし、それ未満のPythonを利用している方は注意が必要です。
Djangoのバージョン | サポートするPythonのバージョン |
1.11 | 2.7、3.4、3.5、3.6、3.7 (1.11.17で追加) |
2.0 | 3.4, 3.5, 3.6, 3.7 |
2.1 | 3.5, 3.6, 3.7 |
2.2 | 3.5, 3.6, 3.7, 3.8 (2.2.8で追加) |
3.0 | 3.6, 3.7, 3.8 |
筆者が運営しているWebアプリをDjango 2.2から3.0にバージョンしましたので、そのログを以下簡単に残しておきます。Djangoの公式サイトにはバージョンアップに関するガイドも用意されているので、そちらもバージョンアップ前に参照いただくのがよいかと思います。
なおこのWebアプリは認証機能としてdjango-allauthパッケージを利用していますが、バージョン0.39.1ではDjango 3.0で動かせなかったので0.40.0にバージョンアップが必要でした。
Webアプリ環境
Before | After | |
サーバー | AWS EC2 | (変更なし) |
DB | PostgreSQL 9.6.5 | (変更なし) |
Python | 3.6.1 | (変更なし) |
Django | 2.2.2 | 3.0 |
django-allauth (認証パッケージ) |
0.39.1 | 0.40.0 |
バージョンアップログ
Djangoのバージョンアップ
$ python -m django –version
2.2.2
$ pip install Django -U
Collecting Django
Downloading https://files.pythonhosted.org/packages/43/d6/0aed0b12c66527748ce5a007da4618a65dfbe1f8fca82eccedf57d60295f/Django-3.0-py3-none-any.whl (7.4MB)
100% |████████████████████████████████| 7.4MB 198kB/s
Requirement already up-to-date: sqlparse>=0.2.2 in /Users/user/data/08_python/venv_private_diary/lib/python3.6/site-packages (from Django)
Collecting pytz (from Django)
Using cached https://files.pythonhosted.org/packages/e7/f9/f0b53f88060247251bf481fa6ea62cd0d25bf1b11a87888e53ce5b7c8ad2/pytz-2019.3-py2.py3-none-any.whl
Collecting asgiref~=3.2 (from Django)
Downloading https://files.pythonhosted.org/packages/a5/cb/5a235b605a9753ebcb2730c75e610fb51c8cab3f01230080a8229fa36adb/asgiref-3.2.3-py2.py3-none-any.whl
Installing collected packages: pytz, asgiref, Django
Found existing installation: pytz 2019.1
Uninstalling pytz-2019.1:
Successfully uninstalled pytz-2019.1
Found existing installation: Django 2.2.2
Uninstalling Django-2.2.2:
Successfully uninstalled Django-2.2.2
Successfully installed Django-3.0 asgiref-3.2.3 pytz-2019.3
$ python -m django –version
3.0
django-allauthのバージョンアップ
$ pip list|grep django-allauth
django-allauth 0.39.1
$ pip install django-allauth -U
Collecting django-allauth
Downloading https://files.pythonhosted.org/packages/ff/11/543503affce1120574e62f2802fcbf1a803b607a2bbf5d15b95623ccd1a5/django-allauth-0.40.0.tar.gz (541kB)
|████████████████████████████████| 542kB 738kB/s
Requirement already satisfied, skipping upgrade: Django>=1.11 in /Users/user/data/08_python/venv_private_diary/lib/python3.6/site-packages (from django-allauth) (3.0)
Requirement already satisfied, skipping upgrade: python3-openid>=3.0.8 in /Users/user/data/08_python/venv_private_diary/lib/python3.6/site-packages (from django-allauth) (3.1.0)
Requirement already satisfied, skipping upgrade: requests-oauthlib>=0.3.0 in /Users/user/data/08_python/venv_private_diary/lib/python3.6/site-packages (from django-allauth) (1.2.0)
Requirement already satisfied, skipping upgrade: requests in /Users/user/data/08_python/venv_private_diary/lib/python3.6/site-packages (from django-allauth) (2.22.0)
Requirement already satisfied, skipping upgrade: pytz in /Users/user/data/08_python/venv_private_diary/lib/python3.6/site-packages (from Django>=1.11->django-allauth) (2019.3)
Requirement already satisfied, skipping upgrade: asgiref~=3.2 in /Users/user/data/08_python/venv_private_diary/lib/python3.6/site-packages (from Django>=1.11->django-allauth) (3.2.3)
Requirement already satisfied, skipping upgrade: sqlparse>=0.2.2 in /Users/user/data/08_python/venv_private_diary/lib/python3.6/site-packages (from Django>=1.11->django-allauth) (0.3.0)
Requirement already satisfied, skipping upgrade: defusedxml in /Users/user/data/08_python/venv_private_diary/lib/python3.6/site-packages (from python3-openid>=3.0.8->django-allauth) (0.6.0)
Requirement already satisfied, skipping upgrade: oauthlib>=3.0.0 in /Users/user/data/08_python/venv_private_diary/lib/python3.6/site-packages (from requests-oauthlib>=0.3.0->django-allauth) (3.0.1)
Requirement already satisfied, skipping upgrade: idna<2.9,>=2.5 in /Users/user/data/08_python/venv_private_diary/lib/python3.6/site-packages (from requests->django-allauth) (2.8)
Requirement already satisfied, skipping upgrade: certifi>=2017.4.17 in /Users/user/data/08_python/venv_private_diary/lib/python3.6/site-packages (from requests->django-allauth) (2019.3.9)
Requirement already satisfied, skipping upgrade: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /Users/user/data/08_python/venv_private_diary/lib/python3.6/site-packages (from requests->django-allauth) (1.25.3)
Requirement already satisfied, skipping upgrade: chardet<3.1.0,>=3.0.2 in /Users/user/data/08_python/venv_private_diary/lib/python3.6/site-packages (from requests->django-allauth) (3.0.4)
Installing collected packages: django-allauth
Found existing installation: django-allauth 0.39.1
Uninstalling django-allauth-0.39.1:
Successfully uninstalled django-allauth-0.39.1
Running setup.py install for django-allauth … done
Successfully installed django-allauth-0.40.0
$ pip list|grep django-allauth
django-allauth 0.40.0