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

task/WP-271 Upgrade Django to 4.2 and update other 3rd party dependencies #895

Merged
merged 15 commits into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions server/conf/docker/docker-compose-dev.all.debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ services:
- 127.0.0.1:9200:9200

postgres:
image: postgres:11.5
image: postgres:12.0
volumes:
- core_portal_postgres_data:/var/lib/postgresql/data/portal
container_name: core_portal_postgres
Expand All @@ -61,7 +61,7 @@ services:
- PGDATA=/var/lib/postgresql/data/portal

postgrescms:
image: postgres:11.5
image: postgres:12.0
volumes:
shayanaijaz marked this conversation as resolved.
Show resolved Hide resolved
- core_cms_postgres_data:/var/lib/postgresql/data/portal
container_name: core_cms_postgres
Expand Down
1 change: 1 addition & 0 deletions server/conf/nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ http {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_redirect off;
proxy_set_header X-Forwarded-Proto https;
shayanaijaz marked this conversation as resolved.
Show resolved Hide resolved

# ** NOTE: Uncomment these lines below to configure a uwsgi server instead of http server,
# ** matching deployed configurations. You must also edit docker-compose-dev.all.debug.yml.
Expand Down
2,202 changes: 1,235 additions & 967 deletions server/poetry.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion server/portal/apps/accounts/api/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
.. :module:: apps.accounts.api.urls
:synopsis: Manager handling anything pertaining to accounts
"""
from django.conf.urls import re_path
from django.urls import re_path
from portal.apps.accounts.api.views.systems import SystemKeysView

app_name = 'portal_accounts_api'
Expand Down
2 changes: 1 addition & 1 deletion server/portal/apps/accounts/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
.. module:: portal.apps.accounts.urls
:synopsis: Accounts URLs
"""
from django.conf.urls import re_path
from django.urls import re_path
from django.contrib.auth.views import LogoutView
from portal.apps.accounts.views import accounts
from portal.apps.accounts import views
Expand Down
2 changes: 1 addition & 1 deletion server/portal/apps/auth/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
.. module:: portal.apps.auth.urls
:synopsis: Auth URls
"""
from django.conf.urls import re_path
from django.urls import re_path
from portal.apps.auth import views

app_name = 'portal_auth'
Expand Down
4 changes: 2 additions & 2 deletions server/portal/apps/notifications/consumers_unit_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ async def auth_connect(user):

# Pass session ID in headers to authenticate.
communicator = WebsocketCommunicator(
NotificationsConsumer,
path='/ws/notifications/'
NotificationsConsumer.as_asgi(),
path='/ws/notifications/',
)
communicator.scope['user'] = user
connected, _ = await communicator.connect()
Expand Down
2 changes: 1 addition & 1 deletion server/portal/apps/notifications/routing.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
from portal.apps.notifications.consumers import NotificationsConsumer

websocket_urlpatterns = [
re_path(r'ws/notifications/$', NotificationsConsumer),
re_path(r'ws/notifications/$', NotificationsConsumer.as_asgi()),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

]
2 changes: 1 addition & 1 deletion server/portal/apps/notifications/urls.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from django.conf.urls import re_path
from django.urls import re_path
from portal.apps.notifications.views import ManageNotificationsView


Expand Down
3 changes: 1 addition & 2 deletions server/portal/apps/users/urls.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from django.conf.urls import re_path
from django.urls import path
from django.urls import path, re_path
from portal.apps.users.views import (SearchView, AuthenticatedView, UsageView, AllocationsView, TeamView,
UserDataView, TasUsersView, AllocationUsageView, AllocationManagementView)

Expand Down
3 changes: 2 additions & 1 deletion server/portal/apps/webhooks/models.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from django.db import models
from django.conf import settings
from datetime import datetime
from django.utils import timezone


class ExternalCall(models.Model):
Expand All @@ -21,7 +22,7 @@ class ExternalCall(models.Model):
)

# Timestamp for outbound external call
time = models.DateTimeField(default=datetime.now)
time = models.DateTimeField(default=timezone.now)

# Callback class to be executed when a webhook is received
callback = models.CharField(max_length=300, null=True)
Expand Down
2 changes: 1 addition & 1 deletion server/portal/apps/workspace/api/urls.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Workpace API Urls
"""
from django.conf.urls import re_path
from django.urls import re_path
from portal.apps.workspace.api import views


Expand Down
2 changes: 1 addition & 1 deletion server/portal/apps/workspace/urls.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Workspace URLs
"""
from django.conf.urls import re_path
from django.urls import re_path
from portal.apps.workspace import views

urlpatterns = [
Expand Down
8 changes: 6 additions & 2 deletions server/portal/asgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@

import os
import django
from channels.routing import get_default_application
from channels.routing import get_default_application, ProtocolTypeRouter
from django.core.asgi import get_asgi_application


os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'portal.settings.settings')
django.setup()
application = get_default_application()
application = ProtocolTypeRouter({
"http": get_asgi_application(),
})
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Collaborator

@jarosenb jarosenb Nov 6, 2023

Choose a reason for hiding this comment

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

Do websocket notifications work without defining a mapping for "websocket" in the ProtocolTypeRouter? https://channels.readthedocs.io/en/latest/topics/routing.html?highlight=protocoltyperouter#protocoltyperouter

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The websocket mapping is defined in routing.py and from my testing notifications are working fine

8 changes: 5 additions & 3 deletions server/portal/settings/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@

INSTALLED_APPS = [

# Django Channels
'channels',
'daphne',

Copy link
Contributor Author

Choose a reason for hiding this comment

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

# Core Django.
'django.contrib.admin',
'django.contrib.auth',
Expand All @@ -75,9 +79,7 @@
'django.contrib.sitemaps',
'django.contrib.sessions.middleware',

# Django Channels
'channels',

# Pipeline.
'termsandconditions',
'impersonate',

Expand Down
7 changes: 4 additions & 3 deletions server/portal/settings/unit_test_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@

INSTALLED_APPS = [

# Django Channels
'channels',
'daphne',

# Core Django.
'django.contrib.admin',
'django.contrib.auth',
Expand All @@ -58,9 +62,6 @@
'django.contrib.sitemaps',
'django.contrib.sessions.middleware',

# Django Channels
'channels',

# Pipeline.
'termsandconditions',
'impersonate',
Expand Down
8 changes: 5 additions & 3 deletions server/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ authors = ["TACC-WMA <[email protected]>"]
readme = "README.md"

[tool.poetry.dependencies]
Django = "^3.2"
Django = "^4.2"
python = "^3.11"
elasticsearch-dsl = "^7.2.1"
paramiko = "^2.10.1"
Expand All @@ -26,8 +26,9 @@ elasticsearch = "^7.7.1"
uwsgi = "^2.0.22"
requests = "^2.31.0"
django-impersonate = "^1.5"
channels = "^2.4.0"
channels-redis = "^3.1.0"
channels = "^4.0.0"
channels-redis = "^4.1.0"
daphne = "^4.0.0"
pytas = {git = "https://bitbucket.org/taccaci/pytas.git", tag = "v1.6.0"}
google-auth = "^1.23.0"
google-auth-oauthlib = "^0.4.2"
Expand All @@ -46,6 +47,7 @@ pytest-mock = "^3.10.0"
mock = "^5.0.2"
pytest-cov = "^4.0.0"
pytest-django = "^4.5.2"
pytest-asyncio = "^0.21.1"
flake8 = "^6.0.0"
coverage = "^7.2.5"
requests-mock = "^1.10.0"
Expand Down
9 changes: 0 additions & 9 deletions server/pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,6 @@
DJANGO_SETTINGS_MODULE = portal.settings.unit_test_settings
python_files = tests.py *unit_test.py

filterwarnings =
ignore::DeprecationWarning:django.*:
ignore::DeprecationWarning:openapi_schema_validator.*:
ignore::DeprecationWarning:openapi_spec_validator.*:
ignore::DeprecationWarning:openapi_core.*:
ignore::DeprecationWarning:kombu.*:
ignore::DeprecationWarning:pkg_resources.*:
ignore:.*Django now detects this configuration.*:django.utils.deprecation.RemovedInDjango41Warning

markers =
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Still need to filter a couple of warnings.

  • The twisted package has a PR open currently to address the cgi deprecation warning
  • We can ignore any RemovedInDjango50Warning since Django 5 support is still limited at the moment

asyncio: mark a test as asyncio.

Expand Down
Loading