7
0
mirror of https://github.com/ChristianLight/tutor.git synced 2024-06-10 01:32:21 +00:00
tutor/tutor/templates/apps/openedx/settings/partials/common_lms.py

53 lines
1.7 KiB
Python
Raw Normal View History

{% include "apps/openedx/settings/partials/common_all.py" %}
######## Common LMS settings
LOGIN_REDIRECT_WHITELIST = ["{{ CMS_HOST }}"]
Fix TypeError due to None LEARNING_MICROFRONTEND_URL setting value We observed the following error in production: lms_1 | 2020-06-22 14:03:10,220 ERROR 10 [django.request] [user 4] log.py:228 - Internal Server Error: /xblock/block-v1:edX+DemoX+Demo_Course+type@html+block@6bcccc2d7343416e9e03 fd7325b2f232 lms_1 | Traceback (most recent call last): lms_1 | File "/openedx/venv/lib/python3.5/site-packages/django/core/handlers/exception.py", line 34, in inner lms_1 | response = get_response(request) lms_1 | File "/openedx/venv/lib/python3.5/site-packages/django/core/handlers/base.py", line 115, in _get_response lms_1 | response = self.process_exception_by_middleware(e, request) lms_1 | File "/openedx/venv/lib/python3.5/site-packages/django/core/handlers/base.py", line 113, in _get_response lms_1 | response = wrapped_callback(request, *callback_args, **callback_kwargs) lms_1 | File "/openedx/venv/lib/python3.5/site-packages/django/views/decorators/http.py", line 40, in inner lms_1 | return func(request, *args, **kwargs) lms_1 | File "/openedx/edx-platform/common/djangoapps/util/views.py", line 66, in inner lms_1 | response = view_func(request, *args, **kwargs) lms_1 | File "/openedx/venv/lib/python3.5/site-packages/django/views/decorators/clickjacking.py", line 50, in wrapped_view lms_1 | resp = view_func(*args, **kwargs) lms_1 | File "/openedx/venv/lib/python3.5/site-packages/django/utils/decorators.py", line 142, in _wrapped_view lms_1 | response = view_func(request, *args, **kwargs) lms_1 | File "/openedx/edx-platform/lms/djangoapps/courseware/views/views.py", line 1683, in render_xblock lms_1 | 'is_learning_mfe': request.META.get('HTTP_REFERER', '').startswith(settings.LEARNING_MICROFRONTEND_URL), lms_1 | TypeError: startswith first arg must be str or a tuple of str, not NoneType
2020-06-22 14:18:21 +00:00
v11.0.0 (2020-12-09) - 💥[Improvement] Upgrade Open edX to Koa - 💥 Setting changes: - The ``ACTIVATE_HTTPS`` setting was renamed to ``ENABLE_HTTPS``. - Other ``ACTIVATE_*`` variables were all renamed to ``RUN_*``. - The ``WEB_PROXY`` setting was removed and ``RUN_CADDY`` was added. - The ``NGINX_HTTPS_PORT`` setting is deprecated. - Architectural changes: - Use Caddy as a web proxy for automated SSL/TLS certificate generation: - Nginx no longer listens to port 443 for https traffic - The Caddy configuration file comes with a new ``caddyfile`` patch for much simpler SSL/TLS management. - Configuration files for web proxies are no longer provided. - Kubernetes deployment no longer requires setting up a custom Ingress resource or custom manager. - Gunicorn and Whitenoise are replaced by uwsgi: this increases boostrap performance and makes it no longer necessary to mount media folders in the Nginx container. - Replace memcached and rabbitmq by redis. - Additional features: - Make it possible to disable all plugins at once with ``plugins disable all``. - Add ``tutor k8s wait`` command to wait for a pod to become ready - Faster, more reliable static assets with local memory caching - Deprecation: proxy files for Apache and Nginx are no longer provided out of the box. - Removed plugin `{{ patch (...) }}` statements: - "https-create", "k8s-ingress-rules", "k8s-ingress-tls-hosts": these are no longer necessary. Instead, declare your app in the "caddyfile" patch. - "local-docker-compose-nginx-volumes": this patch was primarily used to serve media assets. The recommended is now to serve assets with uwsgi.
2020-09-17 10:53:14 +00:00
# Better layout of honor code/tos links during registration
REGISTRATION_EXTRA_FIELDS["terms_of_service"] = "required"
REGISTRATION_EXTRA_FIELDS["honor_code"] = "hidden"
# Fix media files paths
PROFILE_IMAGE_BACKEND["options"]["location"] = os.path.join(
MEDIA_ROOT, "profile-images/"
)
COURSE_CATALOG_VISIBILITY_PERMISSION = "see_in_catalog"
COURSE_ABOUT_VISIBILITY_PERMISSION = "see_about_page"
# Allow insecure oauth2 for local interaction with local containers
OAUTH_ENFORCE_SECURE = False
# Email settings
fix: broken bulk emails because of LazyStaticAbsoluteUrl (again) The LazyStaticAbsoluteUrl object was breaking bulk emails again with the following stacktrace: 2022-01-11 13:50:10,591 ERROR 12 [celery.app.trace] [user None] [ip None] trace.py:255 - Task lms.djangoapps.instructor_task.tasks.send_bulk_course_email[26b93357-018a-408f-b3f7-b69722447c5b] raised unexpected: EncodeError(TypeError('Object of type LazyStaticAbsoluteUrl is not JSON serializable')) Traceback (most recent call last): File "/openedx/venv/lib/python3.8/site-packages/kombu/serialization.py", line 50, in _reraise_errors yield File "/openedx/venv/lib/python3.8/site-packages/kombu/serialization.py", line 221, in dumps payload = encoder(data) File "/openedx/venv/lib/python3.8/site-packages/kombu/utils/json.py", line 69, in dumps return _dumps(s, cls=cls or _default_encoder, File "/openedx/venv/lib/python3.8/site-packages/simplejson/__init__.py", line 398, in dumps return cls( File "/openedx/venv/lib/python3.8/site-packages/simplejson/encoder.py", line 296, in encode chunks = self.iterencode(o, _one_shot=True) File "/openedx/venv/lib/python3.8/site-packages/simplejson/encoder.py", line 378, in iterencode return _iterencode(o, 0) File "/openedx/venv/lib/python3.8/site-packages/kombu/utils/json.py", line 59, in default return super(JSONEncoder, self).default(o) File "/openedx/venv/lib/python3.8/site-packages/simplejson/encoder.py", line 272, in default raise TypeError('Object of type %s is not JSON serializable' % TypeError: Object of type LazyStaticAbsoluteUrl is not JSON serializable The point of that lazy object was to link to the lms logo even when a custom theme was enabled. Luckily, we no longer need this lazy evaluation because we now have theme-agnostic urls that point to static asset (see https://github.com/openedx/edx-platform/pull/29461). See: https://discuss.overhang.io/t/error-while-sending-bulk-emails-lazystaticabsoluteurl-is-not-json-serializable/2176/
2022-01-19 13:51:13 +00:00
DEFAULT_EMAIL_LOGO_URL = LMS_ROOT_URL + "/theming/asset/images/logo.png"
BULK_EMAIL_SEND_USING_EDX_ACE = True
2022-11-22 12:53:29 +00:00
FEATURES["ENABLE_FOOTER_MOBILE_APP_LINKS"] = False
# Branding
MOBILE_STORE_ACE_URLS = {}
SOCIAL_MEDIA_FOOTER_ACE_URLS = {}
# Make it possible to hide courses by default from the studio
SEARCH_SKIP_SHOW_IN_CATALOG_FILTERING = False
2022-11-22 12:53:29 +00:00
# Caching
CACHES["staticfiles"] = {
"KEY_PREFIX": "staticfiles_lms",
"BACKEND": "django.core.cache.backends.locmem.LocMemCache",
"LOCATION": "staticfiles_lms",
}
CACHES["ora2-storage"] = {
"KEY_PREFIX": "ora2-storage",
"BACKEND": "django_redis.cache.RedisCache",
"LOCATION": "redis://{% if REDIS_USERNAME and REDIS_PASSWORD %}{{ REDIS_USERNAME }}:{{ REDIS_PASSWORD }}{% endif %}@{{ REDIS_HOST }}:{{ REDIS_PORT }}/{{ OPENEDX_CACHE_REDIS_DB }}",
}
# Create folders if necessary
for folder in [DATA_DIR, LOG_DIR, MEDIA_ROOT, STATIC_ROOT_BASE, ORA2_FILEUPLOAD_ROOT]:
if not os.path.exists(folder):
os.makedirs(folder, exist_ok=True)
{{ patch("openedx-lms-common-settings") }}
######## End of common LMS settings