Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Python 4.2 #123

Merged
merged 8 commits into from
Sep 29, 2023
Merged

Update to Python 4.2 #123

merged 8 commits into from
Sep 29, 2023

Conversation

hamishwillee
Copy link
Collaborator

@hamishwillee hamishwillee commented Jul 28, 2023

  • Build 4.10 and remove deprecation warnings
  • Build 4.2.3 and remove deprecation warnings
  • Copy across 4.2 template comments so it looks like we started from 4.2

These are minimal updates. There were more changes in release notes that could have affected this, but none that IMO should be made. Docs update and explanation of that in mdn/content#28278

response = self.client.post(reverse('renew-book-librarian', kwargs={'pk': self.test_bookinstance1.pk}),
{'renewal_date': date_in_past})
self.assertEqual(response.status_code, 200)
self.assertFormError(response, 'form', 'renewal_date', 'Invalid date - renewal in past')
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and line 286 were only updates for 4.1. Deprecation warning - changed to assertFormError(response.context['form'], 'renewal_date', ...)

# Static file serving.
# http://whitenoise.evans.io/en/stable/django.html#django-middleware
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
STORAGES = {
Copy link
Collaborator Author

@hamishwillee hamishwillee Jul 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

STATICFILES_STORAGE setting is deprecated and replaced by STORAGES.

Comment on lines 135 to +141
import dj_database_url
db_from_env = dj_database_url.config(conn_max_age=500)
DATABASES['default'].update(db_from_env)

if 'DATABASE_URL' in os.environ:
DATABASES['default'] = dj_database_url.config(
conn_max_age=500,
conn_health_checks=True,
)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI, this change needed because dj_database_url was updated to latest version, which gives a warning if the DATABASE_URL Is not defined. This is a valid case, and previously did not warn. I could have fixed it by created a default URL in the config() call but I prefer this approach (and have tested it).

requirements.txt Outdated
Django==4.2.3
dj-database-url==2.0.0
gunicorn==21.2.0
psycopg2-binary==2.9.6
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Django 4.2 supports psycopg (3) but railway couldn't find it. So not updating to latest.

@hamishwillee hamishwillee marked this pull request as ready for review July 31, 2023 07:55
@hamishwillee hamishwillee changed the title [WIP] Update to Python 4.2 - in steps Update to Python 4.2 - in steps Jul 31, 2023
@hamishwillee hamishwillee changed the title Update to Python 4.2 - in steps Update to Python 4.2 Jul 31, 2023
requirements.txt Outdated Show resolved Hide resolved
@github-actions github-actions bot added the idle Issues and pull requests with no activity for three months. label Aug 30, 2023
@hamishwillee hamishwillee merged commit 3202d5a into main Sep 29, 2023
2 checks passed
@hamishwillee hamishwillee deleted the update_4_2 branch September 29, 2023 00:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
idle Issues and pull requests with no activity for three months.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant