Skip to content

Commit 1975772

Browse files
Merge pull request #45 from FSU-ACM/dev
Actions workflow updates + settings module cleanup
2 parents 8ef8b61 + 48a7558 commit 1975772

File tree

6 files changed

+22
-29
lines changed

6 files changed

+22
-29
lines changed

.github/workflows/pages.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,14 @@ concurrency:
2727
cancel-in-progress: true
2828

2929
jobs:
30-
# Build job
3130
build:
3231
runs-on: ubuntu-latest
3332
defaults:
3433
run:
3534
working-directory: docs
3635
steps:
3736
- name: Checkout
38-
uses: actions/checkout@v3
37+
uses: actions/checkout@v4
3938
- name: Setup Ruby
4039
uses: ruby/setup-ruby@v1
4140
with:
@@ -45,19 +44,17 @@ jobs:
4544
working-directory: '${{ github.workspace }}/docs' # Use docs/ directory
4645
- name: Setup Pages
4746
id: pages
48-
uses: actions/configure-pages@v3
47+
uses: actions/configure-pages@v4
4948
- name: Build with Jekyll
5049
# Outputs to the './_site' directory by default
5150
run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"
5251
env:
5352
JEKYLL_ENV: production
5453
- name: Upload artifact
5554
# Automatically uploads an artifact from the './_site' directory by default
56-
uses: actions/upload-pages-artifact@v1
55+
uses: actions/upload-pages-artifact@v3
5756
with:
5857
path: "docs/_site/"
59-
60-
# Deployment job
6158
deploy:
6259
environment:
6360
name: github-pages
@@ -67,4 +64,4 @@ jobs:
6764
steps:
6865
- name: Deploy to GitHub Pages
6966
id: deployment
70-
uses: actions/deploy-pages@v2
67+
uses: actions/deploy-pages@v4

src/contestsuite/context_processors.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
from .settings import CACHE_TIMEOUT, DEBUG, GTAG, PCS_DOCS_URL
2-
1+
from contestsuite.settings import CACHE_TIMEOUT, DEBUG, GTAG, PCS_DOCS_URL
32

43
def app_settings(request):
54
"""

src/contestsuite/flowerconfig.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from contestsuite.settings import get_secret
22

3-
43
# Celery Flower configuration
54
# https://flower.readthedocs.io/en/latest/config.html
65

@@ -13,7 +12,7 @@
1312

1413
if not debug:
1514
basic_auth = [
16-
get_secret('FLOWER_USER', 'contestadmin') + ':' + get_secret('FLOWER_PASSWORD', 'seminoles1!')
15+
f"{get_secret('FLOWER_USER', 'contestadmin')}:{get_secret('FLOWER_PASSWORD', 'seminoles1!')}"
1716
]
1817

1918
if get_secret('FLOWER_COOKIE_KEY'):

src/contestsuite/settings.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,14 @@
44
Generated by 'django-admin startproject' using Django 2.2.5.
55
66
For more information on this file, see
7-
https://docs.djangoproject.com/en/2.2/topics/settings/
7+
https://docs.djangoproject.com/en/4.2/topics/settings/
88
99
For the full list of settings and their values, see
10-
https://docs.djangoproject.com/en/2.2/ref/settings/
10+
https://docs.djangoproject.com/en/4.2/ref/settings/
1111
"""
1212

1313
import os
1414

15-
1615
def get_secret(key, default=None):
1716
"""
1817
Simple function to read an environment variable and return a default if the variable
@@ -26,13 +25,12 @@ def get_secret(key, default=None):
2625
return f.read().strip()
2726
return value
2827

29-
3028
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
3129

3230
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
3331

3432
# Quick-start development settings - unsuitable for production
35-
# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
33+
# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/
3634

3735
# SECURITY WARNING: keep the secret key used in production secret!
3836
# Raises django's ImproperlyConfigured exception if SECRET_KEY not in os.environ
@@ -56,7 +54,7 @@ def get_secret(key, default=None):
5654
if os.getenv('ALLOWED_HOSTS'):
5755
ALLOWED_HOSTS = ALLOWED_HOSTS + get_secret('ALLOWED_HOSTS').split(',')
5856
CSRF_TRUSTED_ORIGINS = [
59-
'https://'+hostname if 'https://' not in hostname else hostname for hostname in ALLOWED_HOSTS]
57+
f"https://{hostname}" if 'https://' not in hostname else hostname for hostname in ALLOWED_HOSTS]
6058

6159

6260
# Application definition
@@ -120,7 +118,7 @@ def get_secret(key, default=None):
120118

121119

122120
# Database
123-
# https://docs.djangoproject.com/en/2.2/ref/settings/#databases
121+
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases
124122

125123
# Parse database connection url strings like psql://user:pass@127.0.0.1:8458/db
126124
# read os.environ['DATABASE_URL'] and raises ImproperlyConfigured exception if not found
@@ -144,7 +142,7 @@ def get_secret(key, default=None):
144142

145143

146144
# Cache
147-
# https://docs.djangoproject.com/en/2.2/ref/settings/#caches
145+
# https://docs.djangoproject.com/en/4.2/ref/settings/#caches
148146

149147
CACHES = {
150148
'default': {
@@ -160,7 +158,7 @@ def get_secret(key, default=None):
160158

161159

162160
# Password validation
163-
# https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators
161+
# https://docs.djangoproject.com/en/4.2/ref/settings/#auth-password-validators
164162

165163
AUTH_PASSWORD_VALIDATORS = [
166164
{
@@ -179,7 +177,7 @@ def get_secret(key, default=None):
179177

180178

181179
# Internationalization
182-
# https://docs.djangoproject.com/en/2.2/topics/i18n/
180+
# https://docs.djangoproject.com/en/4.2/topics/i18n/
183181

184182
LANGUAGE_CODE = 'en-us'
185183

@@ -193,7 +191,7 @@ def get_secret(key, default=None):
193191

194192

195193
# Static files (CSS, JavaScript, Images)
196-
# https://docs.djangoproject.com/en/2.2/howto/static-files/
194+
# https://docs.djangoproject.com/en/4.2/howto/static-files/
197195

198196
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
199197
STATIC_URL = 'static/'
@@ -214,7 +212,7 @@ def get_secret(key, default=None):
214212

215213

216214
# Sessions
217-
# https://docs.djangoproject.com/en/3.2/topics/http/sessions/
215+
# https://docs.djangoproject.com/en/4.2/topics/http/sessions/
218216

219217
SESSION_ENGINE = 'django.contrib.sessions.backends.cache'
220218

@@ -223,13 +221,13 @@ def get_secret(key, default=None):
223221

224222

225223
# Messages
226-
# https://docs.djangoproject.com/en/3.2/ref/contrib/messages/
224+
# https://docs.djangoproject.com/en/4.2/ref/contrib/messages/
227225

228226
MESSAGE_STORAGE = 'django.contrib.messages.storage.session.SessionStorage'
229227

230228

231229
# Email
232-
# https://docs.djangoproject.com/en/3.1/topics/email/
230+
# https://docs.djangoproject.com/en/4.2/topics/email/
233231

234232
if DEBUG:
235233
EMAIL_BACKEND = get_secret('EMAIL_BACKEND', 'django.core.mail.backends.console.EmailBackend')
@@ -272,6 +270,7 @@ def get_secret(key, default=None):
272270

273271
CELERY_BEAT_SCHEDULE = {}
274272

273+
275274
# Discord
276275
# https://discordpy.readthedocs.io/en/stable/
277276

src/contestsuite/urls.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""contestsuite URL Configuration
22
33
The `urlpatterns` list routes URLs to views. For more information please see:
4-
https://docs.djangoproject.com/en/2.2/topics/http/urls/
4+
https://docs.djangoproject.com/en/4.2/topics/http/urls/
55
Examples:
66
Function views
77
1. Add an import: from my_app import views
@@ -13,11 +13,10 @@
1313
1. Import the include() function: from django.urls import include, path
1414
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
1515
"""
16+
1617
from django.contrib import admin
1718
from django.urls import include, path
1819

19-
from .settings import DEBUG
20-
2120
urlpatterns = [
2221
path('', include('core.urls')),
2322
path('accounts/', include('django.contrib.auth.urls')),

src/contestsuite/wsgi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
It exposes the WSGI callable as a module-level variable named ``application``.
55
66
For more information on this file, see
7-
https://docs.djangoproject.com/en/3.2/howto/deployment/wsgi/
7+
https://docs.djangoproject.com/en/4.2/howto/deployment/wsgi/
88
"""
99

1010
import os

0 commit comments

Comments
 (0)