diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index ac2321e..f255773 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -27,7 +27,6 @@ concurrency: cancel-in-progress: true jobs: - # Build job build: runs-on: ubuntu-latest defaults: @@ -35,7 +34,7 @@ jobs: working-directory: docs steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Ruby uses: ruby/setup-ruby@v1 with: @@ -45,7 +44,7 @@ jobs: working-directory: '${{ github.workspace }}/docs' # Use docs/ directory - name: Setup Pages id: pages - uses: actions/configure-pages@v3 + uses: actions/configure-pages@v4 - name: Build with Jekyll # Outputs to the './_site' directory by default run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}" @@ -53,11 +52,9 @@ jobs: JEKYLL_ENV: production - name: Upload artifact # Automatically uploads an artifact from the './_site' directory by default - uses: actions/upload-pages-artifact@v1 + uses: actions/upload-pages-artifact@v3 with: path: "docs/_site/" - - # Deployment job deploy: environment: name: github-pages @@ -67,4 +64,4 @@ jobs: steps: - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@v2 + uses: actions/deploy-pages@v4 diff --git a/src/contestsuite/context_processors.py b/src/contestsuite/context_processors.py index 455284a..cfbefbd 100644 --- a/src/contestsuite/context_processors.py +++ b/src/contestsuite/context_processors.py @@ -1,5 +1,4 @@ -from .settings import CACHE_TIMEOUT, DEBUG, GTAG, PCS_DOCS_URL - +from contestsuite.settings import CACHE_TIMEOUT, DEBUG, GTAG, PCS_DOCS_URL def app_settings(request): """ diff --git a/src/contestsuite/flowerconfig.py b/src/contestsuite/flowerconfig.py index a882086..8c03ca7 100644 --- a/src/contestsuite/flowerconfig.py +++ b/src/contestsuite/flowerconfig.py @@ -1,6 +1,5 @@ from contestsuite.settings import get_secret - # Celery Flower configuration # https://flower.readthedocs.io/en/latest/config.html @@ -13,7 +12,7 @@ if not debug: basic_auth = [ - get_secret('FLOWER_USER', 'contestadmin') + ':' + get_secret('FLOWER_PASSWORD', 'seminoles1!') + f"{get_secret('FLOWER_USER', 'contestadmin')}:{get_secret('FLOWER_PASSWORD', 'seminoles1!')}" ] if get_secret('FLOWER_COOKIE_KEY'): diff --git a/src/contestsuite/settings.py b/src/contestsuite/settings.py index ce7af37..3beeabe 100644 --- a/src/contestsuite/settings.py +++ b/src/contestsuite/settings.py @@ -4,15 +4,14 @@ Generated by 'django-admin startproject' using Django 2.2.5. For more information on this file, see -https://docs.djangoproject.com/en/2.2/topics/settings/ +https://docs.djangoproject.com/en/4.2/topics/settings/ For the full list of settings and their values, see -https://docs.djangoproject.com/en/2.2/ref/settings/ +https://docs.djangoproject.com/en/4.2/ref/settings/ """ import os - def get_secret(key, default=None): """ Simple function to read an environment variable and return a default if the variable @@ -26,13 +25,12 @@ def get_secret(key, default=None): return f.read().strip() return value - # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # Quick-start development settings - unsuitable for production -# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/ +# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! # Raises django's ImproperlyConfigured exception if SECRET_KEY not in os.environ @@ -56,7 +54,7 @@ def get_secret(key, default=None): if os.getenv('ALLOWED_HOSTS'): ALLOWED_HOSTS = ALLOWED_HOSTS + get_secret('ALLOWED_HOSTS').split(',') CSRF_TRUSTED_ORIGINS = [ - 'https://'+hostname if 'https://' not in hostname else hostname for hostname in ALLOWED_HOSTS] + f"https://{hostname}" if 'https://' not in hostname else hostname for hostname in ALLOWED_HOSTS] # Application definition @@ -120,7 +118,7 @@ def get_secret(key, default=None): # Database -# https://docs.djangoproject.com/en/2.2/ref/settings/#databases +# https://docs.djangoproject.com/en/4.2/ref/settings/#databases # Parse database connection url strings like psql://user:pass@127.0.0.1:8458/db # read os.environ['DATABASE_URL'] and raises ImproperlyConfigured exception if not found @@ -144,7 +142,7 @@ def get_secret(key, default=None): # Cache -# https://docs.djangoproject.com/en/2.2/ref/settings/#caches +# https://docs.djangoproject.com/en/4.2/ref/settings/#caches CACHES = { 'default': { @@ -160,7 +158,7 @@ def get_secret(key, default=None): # Password validation -# https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators +# https://docs.djangoproject.com/en/4.2/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [ { @@ -179,7 +177,7 @@ def get_secret(key, default=None): # Internationalization -# https://docs.djangoproject.com/en/2.2/topics/i18n/ +# https://docs.djangoproject.com/en/4.2/topics/i18n/ LANGUAGE_CODE = 'en-us' @@ -193,7 +191,7 @@ def get_secret(key, default=None): # Static files (CSS, JavaScript, Images) -# https://docs.djangoproject.com/en/2.2/howto/static-files/ +# https://docs.djangoproject.com/en/4.2/howto/static-files/ STATIC_ROOT = os.path.join(BASE_DIR, 'static') STATIC_URL = 'static/' @@ -214,7 +212,7 @@ def get_secret(key, default=None): # Sessions -# https://docs.djangoproject.com/en/3.2/topics/http/sessions/ +# https://docs.djangoproject.com/en/4.2/topics/http/sessions/ SESSION_ENGINE = 'django.contrib.sessions.backends.cache' @@ -223,13 +221,13 @@ def get_secret(key, default=None): # Messages -# https://docs.djangoproject.com/en/3.2/ref/contrib/messages/ +# https://docs.djangoproject.com/en/4.2/ref/contrib/messages/ MESSAGE_STORAGE = 'django.contrib.messages.storage.session.SessionStorage' # Email -# https://docs.djangoproject.com/en/3.1/topics/email/ +# https://docs.djangoproject.com/en/4.2/topics/email/ if DEBUG: EMAIL_BACKEND = get_secret('EMAIL_BACKEND', 'django.core.mail.backends.console.EmailBackend') @@ -272,6 +270,7 @@ def get_secret(key, default=None): CELERY_BEAT_SCHEDULE = {} + # Discord # https://discordpy.readthedocs.io/en/stable/ diff --git a/src/contestsuite/urls.py b/src/contestsuite/urls.py index 6a248a8..cacb9dc 100644 --- a/src/contestsuite/urls.py +++ b/src/contestsuite/urls.py @@ -1,7 +1,7 @@ """contestsuite URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: - https://docs.djangoproject.com/en/2.2/topics/http/urls/ + https://docs.djangoproject.com/en/4.2/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views @@ -13,11 +13,10 @@ 1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ + from django.contrib import admin from django.urls import include, path -from .settings import DEBUG - urlpatterns = [ path('', include('core.urls')), path('accounts/', include('django.contrib.auth.urls')), diff --git a/src/contestsuite/wsgi.py b/src/contestsuite/wsgi.py index 118e4a9..15d212f 100644 --- a/src/contestsuite/wsgi.py +++ b/src/contestsuite/wsgi.py @@ -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/3.2/howto/deployment/wsgi/ +https://docs.djangoproject.com/en/4.2/howto/deployment/wsgi/ """ import os