Skip to content

Commit

Permalink
Merge branch 'release/6.5.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
JackMorganNZ committed Jan 23, 2022
2 parents 91b5225 + b4bc106 commit 5abe689
Show file tree
Hide file tree
Showing 139 changed files with 4,387 additions and 347 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/crowdin-actions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ jobs:
uses: actions/checkout@v2

- name: Upload or update source files to Crowdin
uses: crowdin/[email protected].0
uses: crowdin/[email protected].6
with:
upload_sources: true

- name: Download Chinese (simplified) translations
uses: crowdin/[email protected].0
uses: crowdin/[email protected].6
with:
upload_sources: false
download_translations: true
Expand All @@ -42,7 +42,7 @@ jobs:
config: crowdin.yaml

- name: Download French translations
uses: crowdin/[email protected].0
uses: crowdin/[email protected].6
with:
upload_sources: false
download_translations: true
Expand All @@ -60,7 +60,7 @@ jobs:
config: crowdin.yaml

- name: Download German translations
uses: crowdin/[email protected].0
uses: crowdin/[email protected].6
with:
upload_sources: false
download_translations: true
Expand All @@ -78,7 +78,7 @@ jobs:
config: crowdin.yaml

- name: Download Indonesian translations
uses: crowdin/[email protected].0
uses: crowdin/[email protected].6
with:
upload_sources: false
download_translations: true
Expand All @@ -96,7 +96,7 @@ jobs:
config: crowdin.yaml

- name: Download Italian translations
uses: crowdin/[email protected].0
uses: crowdin/[email protected].6
with:
upload_sources: false
download_translations: true
Expand All @@ -114,7 +114,7 @@ jobs:
config: crowdin.yaml

- name: Download Te Reo Māori translations
uses: crowdin/[email protected].0
uses: crowdin/[email protected].6
with:
upload_sources: false
download_translations: true
Expand All @@ -132,7 +132,7 @@ jobs:
config: crowdin.yaml

- name: Download Turkish translations
uses: crowdin/[email protected].0
uses: crowdin/[email protected].6
with:
upload_sources: false
download_translations: true
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-and-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ jobs:
ls artifacts/resources-*/resources.tar.gz | xargs -n1 tar -xz --directory csunplugged/staticfiles/resources --file
- name: Log in to the Container registry
uses: docker/login-action@v1.10.0
uses: docker/login-action@v1.12.0
with:
registry: ghcr.io
username: ${{ github.actor }}
Expand All @@ -299,7 +299,7 @@ jobs:
type=ref,event=branch,priority=2
- name: Build and push Docker image
uses: docker/build-push-action@v2.7.0
uses: docker/build-push-action@v2.8.0
with:
file: ./infrastructure/production/django/Dockerfile
context: .
Expand Down
2 changes: 1 addition & 1 deletion csunplugged/config/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Module for Django system configuration."""

__version__ = "6.4.0"
__version__ = "6.5.0"
72 changes: 45 additions & 27 deletions csunplugged/config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@
# Load operating system environment variables and then prepare to use them
env = environ.Env()

# Wipe default Django logging
LOGGING_CONFIG = None

# APP CONFIGURATION
# ----------------------------------------------------------------------------
DJANGO_APPS = [
Expand All @@ -46,6 +43,7 @@
]

THIRD_PARTY_APPS = [
"corsheaders",
"django_bootstrap_breadcrumbs",
"haystack",
"widget_tweaks",
Expand All @@ -71,6 +69,7 @@
# MIDDLEWARE CONFIGURATION
# ----------------------------------------------------------------------------
MIDDLEWARE = [
"corsheaders.middleware.CorsMiddleware",
"django.middleware.security.SecurityMiddleware",
"whitenoise.middleware.WhiteNoiseMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
Expand Down Expand Up @@ -201,19 +200,14 @@
{
# See: https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-TEMPLATES-BACKEND
"BACKEND": "django.template.backends.django.DjangoTemplates",
"APP_DIRS": True,
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-dirs
"DIRS": [
str(ROOT_DIR.path("templates")),
],
"OPTIONS": {
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-debug
"debug": DEBUG,
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-loaders
# https://docs.djangoproject.com/en/dev/ref/templates/api/#loader-types
"loaders": [
"django.template.loaders.filesystem.Loader",
"django.template.loaders.app_directories.Loader",
],
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-context-processors
"context_processors": [
"django.template.context_processors.debug",
Expand All @@ -240,30 +234,48 @@

# LOGGING
# ------------------------------------------------------------------------------
# Based off https://lincolnloop.com/blog/django-logging-right-way/

logging.config.dictConfig({
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'console': {
# exact format is not important, this is the minimum information
'format': '%(asctime)s %(name)-12s %(levelname)-8s %(message)s',
"version": 1,
"disable_existing_loggers": False,
"formatters": {
"console": {
"format": "%(asctime)s %(name)-20s %(levelname)-10s %(message)s",
},
},
'handlers': {
'console': {
'class': 'logging.StreamHandler',
'formatter': 'console',
"handlers": {
"console": {
"class": "logging.StreamHandler",
"formatter": "console",
},
},
'loggers': {
'': {
'level': 'INFO',
'handlers': ['console', ],
"loggers": {
# Root logger
"": {
"level": env("LOG_LEVEL", default="INFO"),
"handlers": ["console", ],
},
"django": {
"handlers": ["console"],
"level": env("LOG_LEVEL", default="INFO"),
"propagate": False,
},
# Project specific logger
"csunplugged": {
"level": env("LOG_LEVEL", default="INFO"),
"handlers": ["console", ],
# Required to avoid double logging with root logger
"propagate": False,
},
'csunplugged': {
'level': 'INFO',
'handlers': ['console', ],
# required to avoid double logging with root logger
'gunicorn.error': {
"level": env("LOG_LEVEL", default="INFO"),
'handlers': ['console'],
'propagate': False,
},
'gunicorn.access': {
"level": env("LOG_LEVEL", default="INFO"),
'handlers': ['console'],
'propagate': False,
},
},
Expand Down Expand Up @@ -360,3 +372,9 @@
BREADCRUMBS_TEMPLATE = "django_bootstrap_breadcrumbs/bootstrap4.html"
JOBE_SERVER_URL = "http://jobe"
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

CORS_ALLOWED_ORIGINS = [
"http://127.0.0.1:8000",
"http://localhost:8000",
"https://canterbury.ac.nz"
]
10 changes: 0 additions & 10 deletions csunplugged/config/settings/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,6 @@
"django.contrib.auth.hashers.MD5PasswordHasher",
]

# TEMPLATE LOADERS
# ----------------------------------------------------------------------------
# Keep templates in memory so tests run faster
TEMPLATES[0]["OPTIONS"]["loaders"] = [ # noqa: F405
["django.template.loaders.cached.Loader", [
"django.template.loaders.filesystem.Loader",
"django.template.loaders.app_directories.Loader",
], ],
]

# Your local stuff: Below this line define 3rd party library settings
# ----------------------------------------------------------------------------
INSTALLED_APPS += [ # noqa: F405
Expand Down
4 changes: 3 additions & 1 deletion csunplugged/config/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from django.urls import include, path
from django.conf.urls.i18n import i18n_patterns
from django.contrib import admin
from config import views
import environ
env = environ.Env()

Expand All @@ -26,6 +27,7 @@
path('en/search/', include('search.urls', namespace='search')),
path('admin/', admin.site.urls),
path('healthcheck/', HttpResponse),
path('status/', view=views.get_release_and_commit, name="get-release-and-commit")
]

if settings.DEBUG: # pragma: no cover
Expand All @@ -40,7 +42,7 @@
from django.views import defaults
urlpatterns += [
path('400/', defaults.bad_request, kwargs={'exception': Exception('Bad request')}),
path('403/', defaults.permission_denied, kwargs={'exception': Exception('Permissin denied')}),
path('403/', defaults.permission_denied, kwargs={'exception': Exception('Permission denied')}),
path('404/', defaults.page_not_found, kwargs={'exception': Exception('Page not found')}),
path('500/', defaults.server_error),
]
16 changes: 16 additions & 0 deletions csunplugged/config/views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""Views for the config application."""

from django.conf import settings
from django.http import JsonResponse
from config import __version__

from django.views.decorators.http import require_http_methods


@require_http_methods(["GET"])
def get_release_and_commit(request):
"""Return JSON containing the version number and Git commit hash."""
return JsonResponse({
"VERSION_NUMBER": __version__,
"GIT_SHA": settings.GIT_SHA,
})
24 changes: 24 additions & 0 deletions csunplugged/gunicorn.conf.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
"""Configuration file for gunicorn."""

import logging
from gunicorn import glogging

# Reference: https://pythonspeed.com/articles/gunicorn-in-docker/

# Workers
Expand All @@ -12,5 +15,26 @@
secure_scheme_headers = {"X-APPENGINE-HTTPS": "on"}

# Logging


class CustomGunicornLogger(glogging.Logger):
"""Custom logger for Gunicorn."""

def setup(self, cfg):
"""Create logger and add custom filter."""
super().setup(cfg)
logger = logging.getLogger("gunicorn.access")
logger.addFilter(HealthCheckFilter())


class HealthCheckFilter(logging.Filter):
"""Custom filter for Gunicorn logger."""

def filter(self, record):
"""Skip logging requests containing /healthcheck."""
return record.getMessage().find('/healthcheck') == -1


errorlog = "-"
accesslog = "-"
logger_class = CustomGunicornLogger
21 changes: 11 additions & 10 deletions csunplugged/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,38 @@
"dependencies": {},
"devDependencies": {
"ansi-colors": "4.1.1",
"autoprefixer": "10.3.7",
"autoprefixer": "10.4.2",
"bootstrap": "4.6.0",
"browser-sync": "2.27.5",
"browser-sync": "2.27.7",
"browserify": "17.0.0",
"child_process": "1.0.2",
"codemirror": "5.63.3",
"cssnano": "5.0.8",
"codemirror": "5.65.1",
"cssnano": "5.0.15",
"blockly": "7.20211209.2",
"details-element-polyfill": "2.4.0",
"fancy-log": "1.3.3",
"fancy-log": "2.0.0",
"gulp-concat": "2.6.1",
"gulp-error-handle": "1.0.1",
"gulp-filter": "7.0.0",
"gulp-if": "3.0.0",
"gulp-imagemin": "7.1.0",
"gulp-postcss": "9.0.1",
"gulp-sass": "5.0.0",
"gulp-sass": "5.1.0",
"gulp-sourcemaps": "3.0.0",
"gulp-tap": "2.0.0",
"gulp-terser": "2.1.0",
"gulp": "4.0.2",
"intro.js": "4.2.2",
"intro.js": "4.3.0",
"jquery": "3.6.0",
"multiple-select": "1.5.2",
"pixrem": "5.0.0",
"popper.js": "1.16.1",
"postcss": "8.3.9",
"postcss": "8.4.5",
"postcss-flexbugs-fixes": "5.0.2",
"sass": "1.43.2",
"sass": "1.49.0",
"scratchblocks": "uccser/scratchblocks#master",
"vinyl-buffer": "1.0.1",
"yargs": "17.2.1"
"yargs": "17.3.1"
},
"engines": {
"node": ">=8"
Expand Down
5 changes: 5 additions & 0 deletions csunplugged/plugging_it_in/extras/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Plugging It In extras

This folder contains extra files for the Plugging It In application, including:

- `custom-block-based-blocks.xml` - The XML file of the custom blocks for the block-based language, which can be imported into the Blockly Developer Tools to modify the custom blocks if needed.
Loading

0 comments on commit 5abe689

Please sign in to comment.