Skip to content

Commit

Permalink
Django 5.0 (#40)
Browse files Browse the repository at this point in the history
Upgrades Django from 4.2.11 to 5.0.

Went through [Django 5.0 Release
Notes](https://docs.djangoproject.com/en/5.0/releases/5.0/) and made
necessary changes.

This involves upgrading following packages as well:
- [x] pytest-django
- [x] django-stubs

Resolves #21
  • Loading branch information
a-musing-moose authored Jun 20, 2024
2 parents 002546b + d6fc23e commit eb5b401
Show file tree
Hide file tree
Showing 6 changed files with 730 additions and 792 deletions.
4 changes: 2 additions & 2 deletions template/docs/reference/envvars.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,5 @@ more details what this is actually used for and suitable values.
- default `None`

<!-- Links -->
[allows-hosts]: https://docs.djangoproject.com/en/4.1/ref/settings/#std-setting-ALLOWED_HOSTS
[secret-key]: https://docs.djangoproject.com/en/4.1/ref/settings/#secret-key
[allows-hosts]: https://docs.djangoproject.com/en/5.0/ref/settings/#std-setting-ALLOWED_HOSTS
[secret-key]: https://docs.djangoproject.com/en/5.0/ref/settings/#secret-key
1,495 changes: 716 additions & 779 deletions template/poetry.lock

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions template/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ version = "0.1.0"
manage = "{{ project_name }}.manage:main"

[tool.poetry.dependencies]
django = "^4.2.11"
django = "^5.0"
django-environ = "^0.11.2"
psycopg = "^3.1.12"
python = "^3.12"
Expand All @@ -21,7 +21,7 @@ gunicorn = "^22.0.0"
[tool.poetry.group.dev.dependencies]
bandit = "^1.7.4"
black = "^24.3.0"
django-stubs = "^4.2.6"
django-stubs = "^5.0.2"
factory-boy = "^3.3.0"
flake8 = "^6.1.0"
flake8-bandit = "^4.1.1"
Expand All @@ -40,7 +40,7 @@ poetry = "^1.7.0"
pudb = "^2023.1"
pytest = "^7.4.3"
pytest-cov = "^4.1.0"
pytest-django = "^4.7.0"
pytest-django = "^4.8.0"
pytest-playwright = "^0.4.3"
pytest-spec = "^3.2.0"

Expand All @@ -49,6 +49,7 @@ build-backend = "poetry.core.masonry.api"
requires = ["poetry-core"]

[tool.mypy]
strict = true
plugins = ["mypy_django_plugin.main"]

# disallow_any_unimported = true
Expand Down
2 changes: 1 addition & 1 deletion template/src/project_name/main/asgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/4.1/howto/deployment/asgi/
https://docs.djangoproject.com/en/5.0/howto/deployment/asgi/
"""

import os
Expand Down
12 changes: 6 additions & 6 deletions template/src/project_name/main/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
environ.Env.read_env(env_file=BASE_DIR.parent.parent / ".env")

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/
# See https://docs.djangoproject.com/en/5.0/howto/deployment/checklist/

SECRET_KEY: str = env("SECRET_KEY")
DEBUG: bool = env.bool("DEBUG", default=False)
Expand Down Expand Up @@ -68,7 +68,7 @@


# Database
# https://docs.djangoproject.com/en/4.1/ref/settings/#databases
# https://docs.djangoproject.com/en/5.0/ref/settings/#databases

DATABASES = {
# read os.environ['DATABASE_URL'] and raises
Expand All @@ -80,7 +80,7 @@


# Password validation
# https://docs.djangoproject.com/en/4.1/ref/settings/#auth-password-validators
# https://docs.djangoproject.com/en/5.0/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
{
Expand All @@ -101,7 +101,7 @@


# Internationalization
# https://docs.djangoproject.com/en/4.1/topics/i18n/
# https://docs.djangoproject.com/en/5.0/topics/i18n/

LANGUAGE_CODE = "en-au"

Expand All @@ -113,13 +113,13 @@


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.1/howto/static-files/
# https://docs.djangoproject.com/en/5.0/howto/static-files/

STATIC_URL = "static/"
STATICFILES_DIRS = [BASE_DIR / "static"]


# Default primary key field type
# https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field
# https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
2 changes: 1 addition & 1 deletion template/src/project_name/main/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/4.1/howto/deployment/wsgi/
https://docs.djangoproject.com/en/5.0/howto/deployment/wsgi/
"""

import os
Expand Down

0 comments on commit eb5b401

Please sign in to comment.