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

Develop #206

Merged
merged 5 commits into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
9 changes: 4 additions & 5 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@ on:

jobs:
test:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

strategy:
matrix:
django-version:
- '2.2'
- '3.2'
- '4.2'

Expand All @@ -29,7 +28,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: '3.10'

- name: Install Test Dependencies
run: |
Expand All @@ -52,7 +51,7 @@ jobs:
build:
needs: test

runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

steps:
- name: Checkout Repo
Expand All @@ -61,7 +60,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.8
python-version: '3.10'

- name: Set up tags
id: tags
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:20.04 as django-container
FROM ubuntu:22.04 as django-container
WORKDIR /app/
ENV PYTHONUNBUFFERED 1
ENV TZ America/Los_Angeles
Expand All @@ -23,7 +23,7 @@ RUN apt-get update -y && \
openssl \
pkg-config \
python-setuptools \
python3.8-dev \
python3.10-dev \
python3-venv \
python3-pip \
sqlite3 \
Expand Down
2 changes: 2 additions & 0 deletions project/base_settings/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
os.getenv('HOSTNAME'), # Internal hostname
socket.gethostbyname(os.getenv('HOSTNAME')), # IP
]
# Apps that support multiple external hostnames will need to extend this list
CSRF_TRUSTED_ORIGINS = ['https://' + os.getenv('CLUSTER_CNAME')]

if os.getenv('ENV', 'localdev') == 'localdev':
SECRET_KEY = os.getenv('DJANGO_SECRET', get_random_secret_key())
Expand Down
2 changes: 1 addition & 1 deletion project/mail/backends.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2023 UW-IT, University of Washington
# Copyright 2024 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0

from django.core.mail.backends.smtp import EmailBackend as SMTPBackend
Expand Down
2 changes: 1 addition & 1 deletion scripts/call_command.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2021 UW-IT, University of Washington
# Copyright 2024 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0

import django
Expand Down
2 changes: 1 addition & 1 deletion scripts/management_command.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python

# Copyright 2021 UW-IT, University of Washington
# Copyright 2024 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0

from call_command import CallCommand
Expand Down
2 changes: 1 addition & 1 deletion scripts/management_daemon.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python

# Copyright 2021 UW-IT, University of Washington
# Copyright 2024 UW-IT, University of Washington
# SPDX-License-Identifier: Apache-2.0

from call_command import CallCommand
Expand Down
6 changes: 6 additions & 0 deletions tests/test_settings/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ def test_notlocaldev_without_django_secret(self):
with SettingLoader('project.base_settings', ENV='notlocaldev') as base_settings:
self.assertIsNone(base_settings.SECRET_KEY)

class TestAllowedHosts(TestCase):
def test_allowed_hosts(self):
with SettingLoader('project.base_settings', ENV='notlocaldev', CLUSTER_CNAME='test.edu', HOSTNAME='1.2.3.4') as base_settings:
self.assertEqual(base_settings.ALLOWED_HOSTS, ['test.edu', '1.2.3.4', '1.2.3.4'])
self.assertEqual(base_settings.CSRF_TRUSTED_ORIGINS, ['https://test.edu'])

class TestInstalledApps(TestCase):
def test_contains_required_apps(self):
with SettingLoader('project.base_settings') as base_settings:
Expand Down
Loading