mint-o-badges / badgr-server

Open Badge issuing and management with Django
GNU Affero General Public License v3.0
3 stars 1 forks source link

server: Can't hand out badge on staging with recipient name #195

Closed timber-they closed 4 months ago

timber-they commented 4 months ago

If a recipient name ("Name Empfänger:in") is stated while handing out a badge on staging, this fails with a 500 error on the server. Since DEBUG = True on the server, we see the following error message (indicating that something is wrong with our reportlab configuration):

OSError at /v1/issuer/issuers/7F0ZSAkFTESESotXEa_z5Q/badges/1qlcRzz2QmaMPU9FkxWrIg/assertions

handle_pageBegin args=() 
fileName='https://api.staging.openbadges.education/static/images/Logo-Oeb.png' identity=[ImageReader@0x7f666bd21280 filename='https://api.staging.openbadges.education/static/images/Logo-Oeb.png'] Cannot open resource "https://api.staging.openbadges.education/static/images/Logo-Oeb.png"

Request Method: POST
Request URL: https://api.staging.openbadges.education/v1/issuer/issuers/7F0ZSAkFTESESotXEa_z5Q/badges/1qlcRzz2QmaMPU9FkxWrIg/assertions
Django Version: 3.2
Python Executable: /badgr_server/venv/bin/uwsgi
Python Version: 3.8.14
Python Path: ['/badgr_server/apps', '.', '', '/usr/local/lib/python38.zip', '/usr/local/lib/python3.8', '/usr/local/lib/python3.8/lib-dynload', '/badgr_server/venv/lib/python3.8/site-packages', '/badgr_server']
Server time: Mon, 22 Jul 2024 10:52:15 +0200
Installed Applications:
['mainsite',
 'django.contrib.auth',
 'mozilla_django_oidc',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.admin',
 'django_object_actions',
 'markdownify',
 'badgeuser',
 'allauth',
 'allauth.account',
 'allauth.socialaccount',
 'badgrsocialauth',
 'badgrsocialauth.providers.facebook',
 'badgrsocialauth.providers.kony',
 'badgrsocialauth.providers.twitter',
 'allauth.socialaccount.providers.auth0',
 'allauth.socialaccount.providers.linkedin_oauth2',
 'allauth.socialaccount.providers.oauth2',
 'corsheaders',
 'rest_framework',
 'rest_framework.authtoken',
 'django_celery_results',
 'oauth2_provider',
 'oidc',
 'entity',
 'issuer',
 'backpack',
 'externaltools',
 'apispec_drf',
 'composition']
Installed Middleware:
['corsheaders.middleware.CorsMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'oauth2_provider.middleware.OAuth2TokenMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware',
 'mainsite.middleware.XframeExempt500Middleware',
 'mainsite.middleware.MaintenanceMiddleware',
 'badgeuser.middleware.InactiveUserMiddleware']

Traceback (most recent call last):
  File "/badgr_server/venv/lib/python3.8/site-packages/reportlab/lib/utils.py", line 537, in open_for_read
    return open_for_read_by_name(name,mode)
  File "/badgr_server/venv/lib/python3.8/site-packages/reportlab/lib/utils.py", line 477, in open_for_read_by_name
    return open(name,mode)

During handling of the above exception ([Errno 2] No such file or directory: 'https://api.staging.openbadges.education/static/images/Logo-Oeb.png'), another exception occurred:
  File "/badgr_server/venv/lib/python3.8/site-packages/reportlab/lib/utils.py", line 544, in open_for_read
    return BytesIO((datareader if name[:5].lower()=='data:' else rlUrlRead)(name))
  File "/badgr_server/venv/lib/python3.8/site-packages/reportlab/lib/utils.py", line 490, in rlUrlRead
    return urlopen(name).read()
  File "/usr/local/lib/python3.8/urllib/request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/local/lib/python3.8/urllib/request.py", line 531, in open
    response = meth(req, response)
  File "/usr/local/lib/python3.8/urllib/request.py", line 640, in http_response
    response = self.parent.error(
  File "/usr/local/lib/python3.8/urllib/request.py", line 569, in error
    return self._call_chain(*args)
  File "/usr/local/lib/python3.8/urllib/request.py", line 502, in _call_chain
    result = func(*args)
  File "/usr/local/lib/python3.8/urllib/request.py", line 649, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)

During handling of the above exception (HTTP Error 404: Not Found), another exception occurred:
  File "/badgr_server/venv/lib/python3.8/site-packages/reportlab/lib/utils.py", line 655, in __init__
    self.fp = open_for_read(fileName,'b')
  File "/badgr_server/venv/lib/python3.8/site-packages/reportlab/lib/utils.py", line 546, in open_for_read
    raise IOError('Cannot open resource "%s"' % name)

During handling of the above exception (Cannot open resource "https://api.staging.openbadges.education/static/images/Logo-Oeb.png"), another exception occurred:
  File "/badgr_server/venv/lib/python3.8/site-packages/reportlab/platypus/doctemplate.py", line 164, in apply
    getattr(doc,arn)(*args)
  File "/badgr_server/venv/lib/python3.8/site-packages/reportlab/platypus/doctemplate.py", line 1290, in handle_pageBegin
    self._handle_pageBegin()
  File "/badgr_server/venv/lib/python3.8/site-packages/reportlab/platypus/doctemplate.py", line 617, in handle_pageBegin
    self.pageTemplate.onPage(self.canv,self)
  File "/badgr_server/apps/backpack/views.py", line 125, in AllPageSetup
    logo = ImageReader("{}images/Logo-Oeb.png".format(settings.STATIC_URL))
  File "/badgr_server/venv/lib/python3.8/site-packages/reportlab/lib/utils.py", line 696, in __init__
    annotateException('\nfileName=%r identity=%s'%(fileName,self.identity()))
  File "/badgr_server/venv/lib/python3.8/site-packages/reportlab/lib/utils.py", line 1223, in annotateException
    rl_reraise(t,t(sep.join((_ for _ in (msg,str(v),postMsg) if _))),b)
  File "/badgr_server/venv/lib/python3.8/site-packages/reportlab/lib/utils.py", line 141, in rl_reraise
    raise v.with_traceback(b)
  File "/badgr_server/venv/lib/python3.8/site-packages/reportlab/lib/utils.py", line 655, in __init__
    self.fp = open_for_read(fileName,'b')
  File "/badgr_server/venv/lib/python3.8/site-packages/reportlab/lib/utils.py", line 546, in open_for_read
    raise IOError('Cannot open resource "%s"' % name)

During handling of the above exception (
fileName='https://api.staging.openbadges.education/static/images/Logo-Oeb.png' identity=[ImageReader@0x7f666bd21280 filename='https://api.staging.openbadges.education/static/images/Logo-Oeb.png'] Cannot open resource "https://api.staging.openbadges.education/static/images/Logo-Oeb.png"), another exception occurred:
  File "/badgr_server/venv/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/badgr_server/venv/lib/python3.8/site-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/badgr_server/venv/lib/python3.8/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
    return view_func(*args, **kwargs)
  File "/badgr_server/venv/lib/python3.8/site-packages/django/views/generic/base.py", line 70, in view
    return self.dispatch(request, *args, **kwargs)
  File "/badgr_server/venv/lib/python3.8/site-packages/rest_framework/views.py", line 509, in dispatch
    response = self.handle_exception(exc)
  File "/badgr_server/venv/lib/python3.8/site-packages/rest_framework/views.py", line 469, in handle_exception
    self.raise_uncaught_exception(exc)
  File "/badgr_server/venv/lib/python3.8/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
    raise exc
  File "/badgr_server/venv/lib/python3.8/site-packages/rest_framework/views.py", line 506, in dispatch
    response = handler(request, *args, **kwargs)
  File "/badgr_server/venv/lib/python3.8/site-packages/apispec_drf/decorators.py", line 154, in wrapper
    return wrapped(*args, **kwargs)
  File "/badgr_server/apps/issuer/api.py", line 464, in post
    return super(BadgeInstanceList, self).post(request, **kwargs)
  File "/badgr_server/apps/entity/api.py", line 87, in post
    new_instance = serializer.save(created_by=request.user)
  File "/badgr_server/venv/lib/python3.8/site-packages/rest_framework/serializers.py", line 205, in save
    self.instance = self.create(validated_data)
  File "/badgr_server/apps/issuer/serializers_v1.py", line 538, in create
    return self.context.get('badgeclass').issue(
  File "/badgr_server/apps/issuer/models.py", line 817, in issue
    return BadgeInstance.objects.create(
  File "/badgr_server/apps/issuer/managers.py", line 349, in create
    new_instance.notify_earner(badgr_app=badgr_app)
  File "/badgr_server/apps/issuer/models.py", line 1198, in notify_earner
    pdf_document = adapter.generate_pdf_content(slug =  self.entity_id)
  File "/badgr_server/apps/mainsite/account_adapter.py", line 162, in generate_pdf_content
    doc.build(Story, onFirstPage=AllPageSetup, onLaterPages=AllPageSetup, canvasmaker=PageNumCanvas)
  File "/badgr_server/venv/lib/python3.8/site-packages/reportlab/platypus/doctemplate.py", line 1314, in build
    BaseDocTemplate.build(self,flowables, canvasmaker=canvasmaker)
  File "/badgr_server/venv/lib/python3.8/site-packages/reportlab/platypus/doctemplate.py", line 1076, in build
    self.clean_hanging()
  File "/badgr_server/venv/lib/python3.8/site-packages/reportlab/platypus/doctemplate.py", line 588, in clean_hanging
    self.handle_flowable(self._hanging)
  File "/badgr_server/venv/lib/python3.8/site-packages/reportlab/platypus/doctemplate.py", line 922, in handle_flowable
    f.apply(self)
  File "/badgr_server/venv/lib/python3.8/site-packages/reportlab/platypus/doctemplate.py", line 171, in apply
    annotateException("\nhandle_%s args=%s"%(action,ascii(args)))
  File "/badgr_server/venv/lib/python3.8/site-packages/reportlab/lib/utils.py", line 1223, in annotateException
    rl_reraise(t,t(sep.join((_ for _ in (msg,str(v),postMsg) if _))),b)
  File "/badgr_server/venv/lib/python3.8/site-packages/reportlab/lib/utils.py", line 141, in rl_reraise
    raise v.with_traceback(b)
  File "/badgr_server/venv/lib/python3.8/site-packages/reportlab/platypus/doctemplate.py", line 164, in apply
    getattr(doc,arn)(*args)
  File "/badgr_server/venv/lib/python3.8/site-packages/reportlab/platypus/doctemplate.py", line 1290, in handle_pageBegin
    self._handle_pageBegin()
  File "/badgr_server/venv/lib/python3.8/site-packages/reportlab/platypus/doctemplate.py", line 617, in handle_pageBegin
    self.pageTemplate.onPage(self.canv,self)
  File "/badgr_server/apps/backpack/views.py", line 125, in AllPageSetup
    logo = ImageReader("{}images/Logo-Oeb.png".format(settings.STATIC_URL))
  File "/badgr_server/venv/lib/python3.8/site-packages/reportlab/lib/utils.py", line 696, in __init__
    annotateException('\nfileName=%r identity=%s'%(fileName,self.identity()))
  File "/badgr_server/venv/lib/python3.8/site-packages/reportlab/lib/utils.py", line 1223, in annotateException
    rl_reraise(t,t(sep.join((_ for _ in (msg,str(v),postMsg) if _))),b)
  File "/badgr_server/venv/lib/python3.8/site-packages/reportlab/lib/utils.py", line 141, in rl_reraise
    raise v.with_traceback(b)
  File "/badgr_server/venv/lib/python3.8/site-packages/reportlab/lib/utils.py", line 655, in __init__
    self.fp = open_for_read(fileName,'b')
  File "/badgr_server/venv/lib/python3.8/site-packages/reportlab/lib/utils.py", line 546, in open_for_read
    raise IOError('Cannot open resource "%s"' % name)

Exception Type: OSError at /v1/issuer/issuers/7F0ZSAkFTESESotXEa_z5Q/badges/1qlcRzz2QmaMPU9FkxWrIg/assertions
Exception Value: 
handle_pageBegin args=() 
fileName='https://api.staging.openbadges.education/static/images/Logo-Oeb.png' identity=[ImageReader@0x7f666bd21280 filename='https://api.staging.openbadges.education/static/images/Logo-Oeb.png'] Cannot open resource "https://api.staging.openbadges.education/static/images/Logo-Oeb.png"
Request information:
USER: Timber . (timber@opensenselab.org)

GET: No GET data

POST: No POST data

FILES: No FILES data

COOKIES: No cookie data

META:
CONTENT_LENGTH = '400'
CONTENT_TYPE = 'application/json'
DOCUMENT_ROOT = '/etc/nginx/html'
HTTP_ACCEPT = 'application/json'
HTTP_ACCEPT_ENCODING = 'gzip, deflate, br, zstd'
HTTP_ACCEPT_LANGUAGE = 'en-GB,en-US;q=0.9,en;q=0.8'
HTTP_AUTHORIZATION = 'Bearer uwA29fI7g8V33S4IKy3JeFZRMFiwTV'
HTTP_CACHE_CONTROL = 'no-cache'
HTTP_CONTENT_LENGTH = '400'
HTTP_CONTENT_TYPE = 'application/json'
HTTP_DNT = '1'
HTTP_HOST = 'api.staging.openbadges.education'
HTTP_ORIGIN = 'https://staging.openbadges.education'
HTTP_PRAGMA = 'no-cache'
HTTP_PRIORITY = 'u=1, i'
HTTP_REFERER = 'https://staging.openbadges.education/'
HTTP_SEC_CH_UA = '"Not/A)Brand";v="8", "Chromium";v="126", "Google Chrome";v="126"'
HTTP_SEC_CH_UA_MOBILE = '?0'
HTTP_SEC_CH_UA_PLATFORM = '"Linux"'
HTTP_SEC_FETCH_DEST = 'empty'
HTTP_SEC_FETCH_MODE = 'cors'
HTTP_SEC_FETCH_SITE = 'same-site'
HTTP_USER_AGENT = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36'
HTTP_X_FORWARDED_FOR = '192.168.112.1'
HTTP_X_FORWARDED_HOST = 'api.staging.openbadges.education'
HTTP_X_FORWARDED_PORT = '443'
HTTP_X_FORWARDED_PROTO = 'https'
HTTP_X_FORWARDED_SERVER = '6ddd941d4dbe'
HTTP_X_REAL_IP = '192.168.112.1'
PATH_INFO = '/v1/issuer/issuers/7F0ZSAkFTESESotXEa_z5Q/badges/1qlcRzz2QmaMPU9FkxWrIg/assertions'
QUERY_STRING = ''
REMOTE_ADDR = '192.168.128.3'
REMOTE_PORT = '47350'
REQUEST_METHOD = 'POST'
REQUEST_SCHEME = 'http'
REQUEST_URI = '/v1/issuer/issuers/7F0ZSAkFTESESotXEa_z5Q/badges/1qlcRzz2QmaMPU9FkxWrIg/assertions'
SCRIPT_NAME = ''
SERVER_NAME = ''
SERVER_PORT = '80'
SERVER_PROTOCOL = 'HTTP/1.1'
uwsgi.core = 0
uwsgi.node = b'52cb7001c62b'
uwsgi.version = b'2.0.26'
wsgi.errors = <_io.TextIOWrapper name=2 mode='w' encoding='UTF-8'>
wsgi.file_wrapper = <built-in function uwsgi_sendfile>
wsgi.input = <uwsgi._Input object at 0x7f6670f27ed0>
wsgi.multiprocess = True
wsgi.multithread = True
wsgi.run_once = False
wsgi.url_scheme = 'https'
wsgi.version = '(1, 0)'

Settings:
Using settings module mainsite.settings_local
ABSOLUTE_URL_OVERRIDES = {}
ACCOUNT_ADAPTER = 'mainsite.account_adapter.BadgrAccountAdapter'
ACCOUNT_AUTHENTICATION_METHOD = 'email'
ACCOUNT_CONFIRM_EMAIL_ON_GET = True
ACCOUNT_DEFAULT_HTTP_PROTOCOL = 'http'
ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_EMAIL_VERIFICATION = 'mandatory'
ACCOUNT_FORMS = {'add_email': 'badgeuser.account_forms.AddEmailForm'}
ACCOUNT_LOGOUT_ON_GET = True
ACCOUNT_SIGNUP_FORM_CLASS = 'badgeuser.forms.BadgeUserCreationForm'
ACCOUNT_USERNAME_REQUIRED = False
ACCOUNT_USER_MODEL_USERNAME_FIELD = None
ADMINS = []
ADMIN_MEDIA_PREFIX = 'http://localhost:8000/static/admin/'
AISKILLS_API_KEY = '********************'
AISKILLS_ENDPOINT = 'http://49.12.65.167:3001/recommendations/chats'
ALLOWED_HOSTS = ['*']
ALTCHA_API_KEY = '********************'
ALTCHA_SECRET = '********************'
ALTCHA_SPAMFILTER_ENDPOINT = 'https://eu.altcha.org/api/v1/classify?'
API_DOCS_EXCLUDED_SCOPES = '********************'
APPEND_SLASH = True
AUTHCODE_EXPIRES_SECONDS = 600
AUTHCODE_SECRET_KEY = '********************'
AUTHENTICATION_BACKENDS = ['oidc.oeb_oidc_authentication_backend.OebOIDCAuthenticationBackend', 'oauth2_provider.backends.OAuth2Backend', 'rules.permissions.ObjectPermissionBackend', 'badgeuser.backends.CachedModelBackend', 'badgeuser.backends.CachedAuthenticationBackend']
AUTH_PASSWORD_VALIDATORS = '********************'
AUTH_USER_MODEL = 'badgeuser.BadgeUser'
BADGR_APPROVED_ISSUERS_ONLY = False
BADGR_CORS_MODEL = 'mainsite.BadgrApp'
BADGR_PUBLIC_BOT_USERAGENTS = ['LinkedInBot', 'Twitterbot', 'facebook', 'Facebot', 'Slackbot', 'Embedly']
BADGR_PUBLIC_BOT_USERAGENTS_WIDE = ['LinkedInBot', 'Twitterbot', 'facebook', 'Facebot']
CACHES = {'default': {'BACKEND': 'django.core.cache.backends.memcached.PyMemcacheCache', 'LOCATION': 'memcached:11211', 'KEY_FUNCTION': '********************'}}
CACHE_MIDDLEWARE_ALIAS = 'default'
CACHE_MIDDLEWARE_KEY_PREFIX = '********************'
CACHE_MIDDLEWARE_SECONDS = 600
CAIROSVG_VERSION_SUFFIX = '2'
CELERY_ALWAYS_EAGER = True
CELERY_RESULT_BACKEND = None
CORS_ALLOWED_ORIGIN_REGEXES = ['^https://deploy-preview-\\d+--.*\\.netlify\\.app$']
CORS_ALLOW_ALL_ORIGINS = False
CORS_ALLOW_CREDENTIALS = True
CORS_EXPOSE_HEADERS = "('link',)"
CORS_ORIGIN_WHITELIST = "('https://staging.openbadges.education',)"
CORS_URLS_REGEX = '^.*$'
CSRF_COOKIE_AGE = 31449600
CSRF_COOKIE_DOMAIN = None
CSRF_COOKIE_HTTPONLY = False
CSRF_COOKIE_NAME = 'csrftoken'
CSRF_COOKIE_PATH = '/'
CSRF_COOKIE_SAMESITE = 'Lax'
CSRF_COOKIE_SECURE = False
CSRF_FAILURE_VIEW = 'django.views.csrf.csrf_failure'
CSRF_HEADER_NAME = 'HTTP_X_CSRFTOKEN'
CSRF_TRUSTED_ORIGINS = []
CSRF_USE_SESSIONS = False
DATABASES = {'default': {'ENGINE': 'django.db.backends.mysql', 'NAME': 'badgr', 'USER': 'badgr', 'PASSWORD': '********************', 'HOST': 'db', 'PORT': '3306', 'OPTIONS': {}, 'ATOMIC_REQUESTS': False, 'AUTOCOMMIT': True, 'CONN_MAX_AGE': 0, 'TIME_ZONE': None, 'TEST': {'CHARSET': None, 'COLLATION': None, 'MIGRATE': True, 'MIRROR': None, 'NAME': None}}}
DATABASE_ROUTERS = []
DATA_UPLOAD_MAX_MEMORY_SIZE = 2621440
DATA_UPLOAD_MAX_NUMBER_FIELDS = 1000
DATETIME_FORMAT = 'N j, Y, P'
DATETIME_INPUT_FORMATS = ['%Y-%m-%d %H:%M:%S', '%Y-%m-%d %H:%M:%S.%f', '%Y-%m-%d %H:%M', '%m/%d/%Y %H:%M:%S', '%m/%d/%Y %H:%M:%S.%f', '%m/%d/%Y %H:%M', '%m/%d/%y %H:%M:%S', '%m/%d/%y %H:%M:%S.%f', '%m/%d/%y %H:%M']
DATE_FORMAT = 'N j, Y'
DATE_INPUT_FORMATS = ['%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', '%b %d %Y', '%b %d, %Y', '%d %b %Y', '%d %b, %Y', '%B %d %Y', '%B %d, %Y', '%d %B %Y', '%d %B, %Y']
DEBUG = True
DEBUG_ERRORS = True
DEBUG_MEDIA = True
DEBUG_PROPAGATE_EXCEPTIONS = False
DEBUG_STATIC = True
DECIMAL_SEPARATOR = '.'
DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'
DEFAULT_CHARSET = 'utf-8'
DEFAULT_EXCEPTION_REPORTER = 'django.views.debug.ExceptionReporter'
DEFAULT_EXCEPTION_REPORTER_FILTER = 'django.views.debug.SafeExceptionReporterFilter'
DEFAULT_FILE_STORAGE = 'django.core.files.storage.FileSystemStorage'
DEFAULT_FROM_EMAIL = 'staging@openbadges.education'
DEFAULT_HASHING_ALGORITHM = 'sha256'
DEFAULT_INDEX_TABLESPACE = ''
DEFAULT_TABLESPACE = ''
DISALLOWED_USER_AGENTS = []
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'in-v3.mailjet.com'
EMAIL_HOST_PASSWORD = '********************'
EMAIL_HOST_USER = 'c27f0cfd4c68afaa602ba2e1415975b7'
EMAIL_PORT = 587
EMAIL_SSL_CERTFILE = None
EMAIL_SSL_KEYFILE = '********************'
EMAIL_SUBJECT_PREFIX = '[Django] '
EMAIL_TIMEOUT = None
EMAIL_USE_LOCALTIME = False
EMAIL_USE_SSL = False
EMAIL_USE_TLS = True
FILE_UPLOAD_DIRECTORY_PERMISSIONS = None
FILE_UPLOAD_HANDLERS = ['django.core.files.uploadhandler.MemoryFileUploadHandler', 'django.core.files.uploadhandler.TemporaryFileUploadHandler']
FILE_UPLOAD_MAX_MEMORY_SIZE = 2621440
FILE_UPLOAD_PERMISSIONS = 420
FILE_UPLOAD_TEMP_DIR = None
FIRST_DAY_OF_WEEK = 0
FIXTURE_DIRS = ['/badgr_server/etc/fixtures']
FORCE_SCRIPT_NAME = None
FORMAT_MODULE_PATH = None
FORM_RENDERER = 'django.forms.renderers.DjangoTemplates'
GDPR_COMPLIANCE_NOTIFY_ON_FIRST_AWARD = True
GDPR_INFO_URL = None
HTTP_ORIGIN = 'https://api.staging.openbadges.education'
IGNORABLE_404_URLS = []
INSTALLED_APPS = ['mainsite', 'django.contrib.auth', 'mozilla_django_oidc', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.admin', 'django_object_actions', 'markdownify', 'badgeuser', 'allauth', 'allauth.account', 'allauth.socialaccount', 'badgrsocialauth', 'badgrsocialauth.providers.facebook', 'badgrsocialauth.providers.kony', 'badgrsocialauth.providers.twitter', 'allauth.socialaccount.providers.auth0', 'allauth.socialaccount.providers.linkedin_oauth2', 'allauth.socialaccount.providers.oauth2', 'corsheaders', 'rest_framework', 'rest_framework.authtoken', 'django_celery_results', 'oauth2_provider', 'oidc', 'entity', 'issuer', 'backpack', 'externaltools', 'apispec_drf', 'composition']
INTERNAL_IPS = []
LANGUAGES = [('af', 'Afrikaans'), ('ar', 'Arabic'), ('ar-dz', 'Algerian Arabic'), ('ast', 'Asturian'), ('az', 'Azerbaijani'), ('bg', 'Bulgarian'), ('be', 'Belarusian'), ('bn', 'Bengali'), ('br', 'Breton'), ('bs', 'Bosnian'), ('ca', 'Catalan'), ('cs', 'Czech'), ('cy', 'Welsh'), ('da', 'Danish'), ('de', 'German'), ('dsb', 'Lower Sorbian'), ('el', 'Greek'), ('en', 'English'), ('en-au', 'Australian English'), ('en-gb', 'British English'), ('eo', 'Esperanto'), ('es', 'Spanish'), ('es-ar', 'Argentinian Spanish'), ('es-co', 'Colombian Spanish'), ('es-mx', 'Mexican Spanish'), ('es-ni', 'Nicaraguan Spanish'), ('es-ve', 'Venezuelan Spanish'), ('et', 'Estonian'), ('eu', 'Basque'), ('fa', 'Persian'), ('fi', 'Finnish'), ('fr', 'French'), ('fy', 'Frisian'), ('ga', 'Irish'), ('gd', 'Scottish Gaelic'), ('gl', 'Galician'), ('he', 'Hebrew'), ('hi', 'Hindi'), ('hr', 'Croatian'), ('hsb', 'Upper Sorbian'), ('hu', 'Hungarian'), ('hy', 'Armenian'), ('ia', 'Interlingua'), ('id', 'Indonesian'), ('ig', 'Igbo'), ('io', 'Ido'), ('is', 'Icelandic'), ('it', 'Italian'), ('ja', 'Japanese'), ('ka', 'Georgian'), ('kab', 'Kabyle'), ('kk', 'Kazakh'), ('km', 'Khmer'), ('kn', 'Kannada'), ('ko', 'Korean'), ('ky', 'Kyrgyz'), ('lb', 'Luxembourgish'), ('lt', 'Lithuanian'), ('lv', 'Latvian'), ('mk', 'Macedonian'), ('ml', 'Malayalam'), ('mn', 'Mongolian'), ('mr', 'Marathi'), ('my', 'Burmese'), ('nb', 'Norwegian Bokmål'), ('ne', 'Nepali'), ('nl', 'Dutch'), ('nn', 'Norwegian Nynorsk'), ('os', 'Ossetic'), ('pa', 'Punjabi'), ('pl', 'Polish'), ('pt', 'Portuguese'), ('pt-br', 'Brazilian Portuguese'), ('ro', 'Romanian'), ('ru', 'Russian'), ('sk', 'Slovak'), ('sl', 'Slovenian'), ('sq', 'Albanian'), ('sr', 'Serbian'), ('sr-latn', 'Serbian Latin'), ('sv', 'Swedish'), ('sw', 'Swahili'), ('ta', 'Tamil'), ('te', 'Telugu'), ('tg', 'Tajik'), ('th', 'Thai'), ('tk', 'Turkmen'), ('tr', 'Turkish'), ('tt', 'Tatar'), ('udm', 'Udmurt'), ('uk', 'Ukrainian'), ('ur', 'Urdu'), ('uz', 'Uzbek'), ('vi', 'Vietnamese'), ('zh-hans', 'Simplified Chinese'), ('zh-hant', 'Traditional Chinese')]
LANGUAGES_BIDI = ['he', 'ar', 'ar-dz', 'fa', 'ur']
LANGUAGE_CODE = 'de-de'
LANGUAGE_COOKIE_AGE = None
LANGUAGE_COOKIE_DOMAIN = None
LANGUAGE_COOKIE_HTTPONLY = False
LANGUAGE_COOKIE_NAME = 'django_language'
LANGUAGE_COOKIE_PATH = '/'
LANGUAGE_COOKIE_SAMESITE = None
LANGUAGE_COOKIE_SECURE = False
LINKED_DATA_DOCUMENT_FETCHER = 'badgeanalysis.utils.custom_docloader'
LOCALE_PATHS = []
LOGGING = {'version': 1, 'disable_existing_loggers': False, 'handlers': {'mail_admins': {'level': 'ERROR', 'filters': [], 'class': 'django.utils.log.AdminEmailHandler'}, 'badgr_events': {'level': 'DEBUG', 'formatter': 'json', 'class': 'logging.FileHandler', 'filename': '/badgr_server/logs/badgr_events.log'}}, 'loggers': {'django.request': {'handlers': ['badgr_events'], 'level': 'DEBUG', 'propagate': True}, 'Badgr.Events': {'handlers': ['badgr_events'], 'level': 'DEBUG', 'propagate': False}}, 'formatters': {'default': {'format': '%(asctime)s %(levelname)s %(module)s %(message)s'}, 'json': {'()': 'mainsite.formatters.JsonFormatter', 'format': '%(asctime)s', 'datefmt': '%Y-%m-%dT%H:%M:%S%z'}}}
LOGGING_CONFIG = 'logging.config.dictConfig'
LOGIN_BASE_URL = 'https://staging.openbadges.education/auth/login'
LOGIN_REDIRECT_URL = 'https://staging.openbadges.education/auth/login?validateToken'
LOGIN_URL = '/accounts/login/'
LOGOUT_REDIRECT_URL = 'https://staging.openbadges.education/auth/login'
LOGS_DIR = '/badgr_server/logs'
LTI_STORE_IN_SESSION = False
MAINTENANCE_MODE = False
MAINTENANCE_URL = '/maintenance'
MANAGERS = []
MARKDOWNIFY_WHITELIST_TAGS = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'a', 'abbr', 'acronym', 'b', 'blockquote', 'em', 'i', 'li', 'ol', 'p', 'strong', 'ul', 'code', 'pre', 'hr']
MEDIA_ROOT = '/badgr_server/mediafiles'
MEDIA_URL = 'https://api.staging.openbadges.education/media/'
MESSAGE_STORAGE = 'django.contrib.messages.storage.fallback.FallbackStorage'
MIDDLEWARE = ['corsheaders.middleware.CorsMiddleware', 'django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'oauth2_provider.middleware.OAuth2TokenMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'mainsite.middleware.XframeExempt500Middleware', 'mainsite.middleware.MaintenanceMiddleware', 'badgeuser.middleware.InactiveUserMiddleware']
MIGRATION_MODULES = {}
MONTH_DAY_FORMAT = 'F j'
NOUNPROJECT_API_KEY = '********************'
NOUNPROJECT_SECRET = '********************'
NUMBER_GROUPING = 0
OAUTH2_PROVIDER = {'SCOPES': {'r:profile': 'See who you are', 'rw:profile': 'Update your own user profile', 'r:backpack': 'List assertions in your backpack', 'rw:backpack': 'Upload badges into a backpack', 'rw:issuer': 'Create and update issuers, create and update badge classes, and award assertions', 'rw:issuer:*': 'Create and update badge classes, and award assertions for a single issuer', 'rw:serverAdmin': 'Superuser trusted operations on most objects', 'r:assertions': 'Batch receive assertions', 'https://purl.imsglobal.org/spec/ob/v2p1/scope/assertion.readonly': "List assertions in a User's Backpack", 'https://purl.imsglobal.org/spec/ob/v2p1/scope/assertion.create': "Add badges into a User's Backpack", 'https://purl.imsglobal.org/spec/ob/v2p1/scope/profile.readonly': 'See who you are'}, 'DEFAULT_SCOPES': ['r:profile'], 'OAUTH2_VALIDATOR_CLASS': 'mainsite.oauth_validator.BadgrRequestValidator', 'ACCESS_TOKEN_EXPIRE_SECONDS': '********************'}
OAUTH2_PROVIDER_ACCESS_TOKEN_MODEL = '********************'
OAUTH2_PROVIDER_APPLICATION_MODEL = 'oauth2_provider.Application'
OAUTH2_TOKEN_SESSION_TIMEOUT_SECONDS = '********************'
OIDC_OP_AUTHORIZATION_ENDPOINT = 'https://aai.demo.meinbildungsraum.de/realms/nbp-aai/protocol/openid-connect/auth'
OIDC_OP_END_SESSION_ENDPOINT = 'https://aai.demo.meinbildungsraum.de/realms/nbp-aai/protocol/openid-connect/logout'
OIDC_OP_JWKS_ENDPOINT = 'https://aai.demo.meinbildungsraum.de/realms/nbp-aai/protocol/openid-connect/certs'
OIDC_OP_TOKEN_ENDPOINT = '********************'
OIDC_OP_USER_ENDPOINT = 'https://aai.demo.meinbildungsraum.de/realms/nbp-aai/protocol/openid-connect/userinfo'
OIDC_RP_CLIENT_ID = 'c4ceca0a-513b-42fd-9890-87e0a7a97e38'
OIDC_RP_CLIENT_SECRET = '********************'
OIDC_RP_SCOPES = 'openid'
OIDC_RP_SIGN_ALGO = 'RS256'
OIDC_STORE_ACCESS_TOKEN = '********************'
OIDC_STORE_ID_TOKEN = '********************'
OIDC_STORE_REFRESH_TOKEN = '********************'
OIDC_USERNAME_ALGO = 'badgeuser.utils.generate_badgr_username'
OIDC_USE_PKCE = True
OPERATOR_NAME = None
OPERATOR_STREET_ADDRESS = None
OPERATOR_URL = None
PASSWORD_HASHERS = '********************'
PASSWORD_RESET_TIMEOUT = '********************'
PASSWORD_RESET_TIMEOUT_DAYS = '********************'
PREPEND_WWW = False
PRIVACY_POLICY_URL = None
REMOTE_DOCUMENT_FETCHER = 'badgeanalysis.utils.get_document_direct'
REST_FRAMEWORK = {'DEFAULT_PERMISSION_CLASSES': ['rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly'], 'DEFAULT_RENDERER_CLASSES': ('mainsite.renderers.JSONLDRenderer', 'rest_framework.renderers.JSONRenderer', 'rest_framework.renderers.BrowsableAPIRenderer'), 'DEFAULT_AUTHENTICATION_CLASSES': ('mainsite.authentication.BadgrOAuth2Authentication', 'mainsite.authentication.LoggedLegacyTokenAuthentication', 'entity.authentication.ExplicitCSRFSessionAuthentication', 'mozilla_django_oidc.contrib.drf.OIDCAuthentication'), 'DEFAULT_VERSIONING_CLASS': 'rest_framework.versioning.URLPathVersioning', 'DEFAULT_VERSION': 'v1', 'ALLOWED_VERSIONS': ['v1', 'v2', 'bcv1', 'rfc7591'], 'EXCEPTION_HANDLER': 'entity.views.exception_handler', 'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination', 'PAGE_SIZE': 100}
ROOT_URLCONF = 'mainsite.urls'
SAML_EMAIL_KEYS = '********************'
SAML_FIRST_NAME_KEYS = '********************'
SAML_LAST_NAME_KEYS = '********************'
SECRET_KEY = '********************'
SECURE_BROWSER_XSS_FILTER = False
SECURE_CONTENT_TYPE_NOSNIFF = True
SECURE_HSTS_INCLUDE_SUBDOMAINS = False
SECURE_HSTS_PRELOAD = False
SECURE_HSTS_SECONDS = 0
SECURE_PROXY_SSL_HEADER = "('HTTP_X_FORWARDED_PROTO', 'https')"
SECURE_REDIRECT_EXEMPT = []
SECURE_REFERRER_POLICY = 'same-origin'
SECURE_SSL_HOST = None
SECURE_SSL_REDIRECT = False
SERVER_EMAIL = 'root@localhost'
SESSION_CACHE_ALIAS = 'default'
SESSION_COOKIE_AGE = 60
SESSION_COOKIE_DOMAIN = None
SESSION_COOKIE_HTTPONLY = True
SESSION_COOKIE_NAME = 'sessionid'
SESSION_COOKIE_PATH = '/'
SESSION_COOKIE_SAMESITE = 'Lax'
SESSION_COOKIE_SECURE = False
SESSION_ENGINE = 'django.contrib.sessions.backends.db'
SESSION_EXPIRE_AT_BROWSER_CLOSE = False
SESSION_FILE_PATH = None
SESSION_SAVE_EVERY_REQUEST = False
SESSION_SERIALIZER = 'django.contrib.sessions.serializers.JSONSerializer'
SETTINGS_MODULE = 'mainsite.settings_local'
SHORT_DATETIME_FORMAT = 'm/d/Y P'
SHORT_DATE_FORMAT = 'm/d/Y'
SIGNING_BACKEND = 'django.core.signing.TimestampSigner'
SILENCED_SYSTEM_CHECKS = []
SITE_ID = 2
SOCIALACCOUNT_ADAPTER = 'badgrsocialauth.adapter.BadgrSocialAccountAdapter'
SOCIALACCOUNT_EMAIL_REQUIRED = False
SOCIALACCOUNT_EMAIL_VERIFICATION = 'optional'
SOCIALACCOUNT_PROVIDERS = {'kony': {'environment': 'dev'}, 'linkedin_oauth2': {'VERIFIED_EMAIL': True}, 'auth0': {'AUTH0_URL': 'https://mybadges.eu.auth0.com'}}
SPHINX_API_VERSION = '********************'
STATICFILES_DIRS = ['/badgr_server/apps/mainsite/static']
STATICFILES_FINDERS = ['django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder']
STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.StaticFilesStorage'
STATIC_ROOT = '/badgr_server/staticfiles'
STATIC_URL = 'https://api.staging.openbadges.education/static/'
SVG_HTTP_CONVERSION_ENABLED = False
SVG_HTTP_CONVERSION_ENDPOINT = ''
TEMPLATES = [{'BACKEND': 'django.template.backends.django.DjangoTemplates', 'OPTIONS': {'context_processors': ['django.contrib.auth.context_processors.auth', 'django.template.context_processors.debug', 'django.template.context_processors.i18n', 'django.template.context_processors.media', 'django.template.context_processors.request', 'django.template.context_processors.static', 'django.template.context_processors.tz', 'django.contrib.messages.context_processors.messages', 'mainsite.context_processors.extra_settings'], 'loaders': ('django.template.loaders.app_directories.Loader', 'django.template.loaders.filesystem.Loader')}}]
TERMS_OF_SERVICE_URL = None
TEST_NON_SERIALIZED_APPS = []
TEST_RUNNER = 'mainsite.testrunner.BadgrRunner'
THOUSAND_SEPARATOR = ','
TIME_FORMAT = 'P'
TIME_INPUT_FORMATS = ['%H:%M:%S', '%H:%M:%S.%f', '%H:%M']
TIME_ZONE = 'Europe/Berlin'
TOP_DIR = '/badgr_server'
UNSUBSCRIBE_KEY = '********************'
UNSUBSCRIBE_SECRET_KEY = '********************'
USE_I18N = False
USE_L10N = False
USE_THOUSAND_SEPARATOR = False
USE_TZ = True
USE_X_FORWARDED_HOST = False
USE_X_FORWARDED_PORT = False
WSGI_APPLICATION = None
X_FRAME_OPTIONS = 'DENY'
YEAR_MONTH_FORMAT = 'F Y'

You’re seeing this error because you have DEBUG = True in your
Django settings file. Change that to False, and Django will
display a standard page generated by the handler for this status code.
timber-they commented 4 months ago

Apparently this was solved by running docker-compose exec api python /badgr_server/manage.py collectstatic on the server.