Skip to content

Commit

Permalink
feat: upgrade to Django 4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
gsueros committed Oct 6, 2023
1 parent 7cbc2c0 commit 42ed994
Show file tree
Hide file tree
Showing 12 changed files with 46 additions and 67 deletions.
9 changes: 0 additions & 9 deletions .ci/docker-compose-ci.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
version: "2"

services:
mysql57:
image: mysql:5.7
container_name: mysql57
command: mysqld --character-set-server=utf8 --collation-server=utf8_general_ci
environment:
MYSQL_ROOT_PASSWORD: "password"
MYSQL_DATABASE: "discovery"

mysql80:
image: mysql:8.0
container_name: mysql80
Expand Down Expand Up @@ -50,7 +42,6 @@ services:
- ../course_discovery/assets:/edx/var/discovery/staticfiles
command: tail -f /dev/null
depends_on:
- "mysql57"
- "mysql80"
- "es"
- "memcached"
Expand Down
8 changes: 2 additions & 6 deletions .ci/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ set -e

apt-get update
apt-get install -y --no-install-recommends firefox gettext
if [ "$TOXENV" == "py38-django42" ]
then
make requirements_dj42
else
make requirements
fi
make requirements

make test
9 changes: 3 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,10 @@ jobs:
fail-fast: false
matrix:
python-version: ['py38']
django-version: ['django32', 'django42']
db-version: ['mysql57', 'mysql80']
django-version: ['django42']
db-version: [mysql80']
pytest-split-group: [1, 2, 3, 4, 5, 6]
status: ['']
exclude:
- django-version: "django42"
db-version: "mysql57"

steps:
- uses: actions/checkout@v3
Expand All @@ -32,7 +29,7 @@ jobs:
# See https://github.com/actions/toolkit/issues/399
continue-on-error: ${{ matrix.status == 'ignored' }}
- name: Upload coverage
if: matrix.db-version == 'mysql57' # TODO: Remove this condition when removing 'mysql57' db-version.
if: matrix.db-version == 'mysql80'
uses: actions/upload-artifact@v2
with:
name: coverage${{ matrix.pytest-split-group }}
Expand Down
5 changes: 0 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,6 @@ requirements.python: ## Install Python requirements for local development.

requirements: requirements.js requirements.python ## Install Python and JS requirements for local development

requirements.python_dj42: ## Install Python requirements for Django 4.2 env
pip install -r requirements/local.txt -r requirements/django42.txt

requirements_dj42: requirements.js requirements.python_dj42 ## Install Python and JS requirements for Django 4.2 env

production-requirements: ## Install Python and JS requirements for production
pip install -r requirements.txt
npm install --production
Expand Down
11 changes: 10 additions & 1 deletion course_discovery/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,14 @@
EMAIL_USE_TLS = False
EXTRA_APPS = []
SESSION_EXPIRE_AT_BROWSER_CLOSE = False
STATICFILES_STORAGE = "django.contrib.staticfiles.storage.StaticFilesStorage"
STORAGES = {
"default": {
"BACKEND": "django.core.files.storage.FileSystemStorage",
},
"staticfiles": {
"BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage",
},
}
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
Expand Down Expand Up @@ -773,3 +780,5 @@
SIMPLE_HISTORY_DATE_INDEX = False

CSRF_TRUSTED_ORIGINS_WITH_SCHEME = [] # just for Django 4.2 upgrade

USE_DEPRECATED_PYTZ = True
5 changes: 1 addition & 4 deletions requirements/constraints.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Stay on an LTS release
django<4.0
django>=4.2

# We are creating a local copy of the common constraints file and override/remove the global constraint which we don't need.
# This approach is used temporarily and will be improved in https://openedx.atlassian.net/browse/BOM-2721
Expand All @@ -23,9 +23,6 @@ algoliasearch<2.0.0
# Remove this pin once newer stable version is released
authlib==1.0.0rc1

# The latest version require Django 4.0, remove once we have upgraded to Django 4.0
django-admin-sortable2<2.0.0

# The latest versions of django-stdimage has breaking changes
# Remove this pin after fixing them.
django-stdimage<=5.3.0
Expand Down
4 changes: 2 additions & 2 deletions requirements/django.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
django==3.2.22
django-admin-sortable2==1.0.4
django==4.2.6
django-admin-sortable2==2.1.10
2 changes: 0 additions & 2 deletions requirements/django42.txt

This file was deleted.

1 change: 0 additions & 1 deletion requirements/docs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ docutils==0.19
# sphinx
elasticsearch==7.13.4
# via
# -c requirements/common_constraints.txt
# -c requirements/constraints.txt
# elasticsearch-dsl
elasticsearch-dsl==7.4.1
Expand Down
36 changes: 19 additions & 17 deletions requirements/local.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ backports-zoneinfo[tzdata]==0.2.1 ; python_version < "3.9"
# via
# -c requirements/constraints.txt
# celery
# django
# kombu
bcrypt==4.0.1
# via paramiko
Expand All @@ -74,16 +75,18 @@ boltons==21.0.0
# face
# glom
# semgrep
boto3==1.28.60
boto3==1.28.61
# via django-ses
botocore==1.31.60
botocore==1.31.61
# via
# boto3
# s3transfer
bracex==2.4
# via wcmatch
cachetools==5.3.1
# via google-auth
# via
# google-auth
# tox
cairocffi==1.4.0
# via
# -c requirements/constraints.txt
Expand All @@ -106,6 +109,8 @@ cffi==1.16.0
# cryptography
# pynacl
# snowflake-connector-python
chardet==5.2.0
# via tox
charset-normalizer==3.3.0
# via
# aiohttp
Expand Down Expand Up @@ -138,7 +143,9 @@ code-annotations==1.5.0
# edx-lint
# edx-toggles
colorama==0.4.6
# via semgrep
# via
# semgrep
# tox
contentful==2.1.1
# via -r requirements/base.in
coverage[toml]==7.3.2
Expand Down Expand Up @@ -171,7 +178,6 @@ distlib==0.3.7
distro==1.8.0
# via docker-compose
# via
# -c requirements/common_constraints.txt
# -c requirements/constraints.txt
# -r requirements/base.in
# algoliasearch-django
Expand Down Expand Up @@ -218,9 +224,7 @@ distro==1.8.0
# social-auth-app-django
# taxonomy-connector
# xss-utils
# via
# -c requirements/constraints.txt
# -r requirements/base.in
# via -r requirements/base.in
django-appconf==1.0.5
# via django-compressor
django-autocomplete-light==3.9.7
Expand Down Expand Up @@ -410,7 +414,6 @@ edx-toggles==5.1.0
# edx-event-bus-redis
elasticsearch==7.13.4
# via
# -c requirements/common_constraints.txt
# -c requirements/constraints.txt
# -r requirements/base.in
# django-elasticsearch-dsl-drf
Expand Down Expand Up @@ -573,6 +576,7 @@ packaging==21.3
# docker
# drf-yasg
# pydata-sphinx-theme
# pyproject-api
# pytest
# semgrep
# snowflake-connector-python
Expand Down Expand Up @@ -600,6 +604,7 @@ platformdirs==3.11.0
# via
# pylint
# snowflake-connector-python
# tox
# virtualenv
# zeep
pluggy==1.3.0
Expand All @@ -616,8 +621,6 @@ protobuf==4.24.4
# googleapis-common-protos
psutil==5.9.5
# via edx-django-utils
py==1.11.0
# via tox
pyasn1==0.5.0
# via
# pyasn1-modules
Expand Down Expand Up @@ -682,6 +685,8 @@ pyparsing==3.1.1
# via
# httplib2
# packaging
pyproject-api==1.5.0
# via tox
pyrsistent==0.19.3
# via jsonschema
pysocks==1.7.1
Expand Down Expand Up @@ -736,7 +741,6 @@ pytz==2023.3.post1
# via
# -r requirements/base.in
# babel
# django
# django-ses
# djangorestframework
# drf-yasg
Expand Down Expand Up @@ -844,7 +848,6 @@ six==1.16.0
# python-memcached
# python-monkey-business
# requests-file
# tox
# websocket-client
slumber==0.7.1
# via edx-rest-api-client
Expand Down Expand Up @@ -913,16 +916,15 @@ tomli==2.0.1
# via
# coverage
# pylint
# pyproject-api
# pytest
# tox
tomlkit==0.12.1
# via
# pylint
# snowflake-connector-python
tox==3.28.0
# via
# -c requirements/common_constraints.txt
# -r requirements/test.in
tox==4.0.0
# via -r requirements/test.in
tqdm==4.66.1
# via
# openai
Expand Down
18 changes: 7 additions & 11 deletions requirements/production.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,17 @@ backports-zoneinfo[tzdata]==0.2.1 ; python_version < "3.9"
# via
# -c requirements/constraints.txt
# celery
# django
# kombu
beautifulsoup4==4.12.2
# via
# -r requirements/base.in
# taxonomy-connector
billiard==4.1.0
# via celery
boto3==1.28.60
boto3==1.28.61
# via django-ses
botocore==1.31.60
botocore==1.31.61
# via
# boto3
# s3transfer
Expand Down Expand Up @@ -117,9 +118,8 @@ defusedxml==0.7.1
# djangorestframework-xml
# python3-openid
# social-auth-core
django==3.2.22
django==4.2.6
# via
# -c requirements/common_constraints.txt
# -c requirements/constraints.txt
# -r requirements/base.in
# algoliasearch-django
Expand Down Expand Up @@ -164,10 +164,8 @@ django==3.2.22
# social-auth-app-django
# taxonomy-connector
# xss-utils
django-admin-sortable2==1.0.4
# via
# -c requirements/constraints.txt
# -r requirements/base.in
django-admin-sortable2==2.1.10
# via -r requirements/base.in
django-appconf==1.0.5
# via django-compressor
django-autocomplete-light==3.9.7
Expand Down Expand Up @@ -336,7 +334,6 @@ edx-toggles==5.1.0
# edx-event-bus-redis
elasticsearch==7.13.4
# via
# -c requirements/common_constraints.txt
# -c requirements/constraints.txt
# -r requirements/base.in
# django-elasticsearch-dsl-drf
Expand Down Expand Up @@ -545,7 +542,6 @@ python3-openid==3.2.0
pytz==2023.3.post1
# via
# -r requirements/base.in
# django
# django-ses
# djangorestframework
# drf-yasg
Expand Down Expand Up @@ -707,7 +703,7 @@ zipp==3.17.0
# via importlib-metadata
zope-event==5.0
# via gevent
zope-interface==6.0
zope-interface==6.1
# via gevent

# The following packages are considered to be unsafe in a requirements file:
Expand Down
5 changes: 2 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py38-django{32, 42}
envlist = py38-django{42}
skipsdist=true

[pytest]
Expand All @@ -8,8 +8,7 @@ testpaths = course_discovery/apps

[testenv]
deps =
django32: -r requirements/django.txt
django42: -r requirements/django42.txt
django42: -r requirements/django.txt
-r{toxinidir}/requirements/local.txt
passenv =
CONN_MAX_AGE
Expand Down

0 comments on commit 42ed994

Please sign in to comment.