2019-10-18 12:54:09 +00:00
|
|
|
{% include "apps/openedx/settings/partials/common_all.py" %}
|
2019-10-17 08:22:04 +00:00
|
|
|
|
|
|
|
######## Common LMS settings
|
2019-12-24 16:22:12 +00:00
|
|
|
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
|
|
|
|
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"
|
|
|
|
|
2019-04-24 13:40:35 +00:00
|
|
|
# Fix media files paths
|
2019-05-05 09:45:24 +00:00
|
|
|
PROFILE_IMAGE_BACKEND["options"]["location"] = os.path.join(
|
|
|
|
MEDIA_ROOT, "profile-images/"
|
|
|
|
)
|
2019-04-24 13:40:35 +00:00
|
|
|
|
2019-12-09 09:18:54 +00:00
|
|
|
COURSE_CATALOG_VISIBILITY_PERMISSION = "see_in_catalog"
|
|
|
|
COURSE_ABOUT_VISIBILITY_PERMISSION = "see_about_page"
|
2019-04-24 13:40:35 +00:00
|
|
|
|
2020-01-10 12:14:55 +00:00
|
|
|
# Allow insecure oauth2 for local interaction with local containers
|
|
|
|
OAUTH_ENFORCE_SECURE = False
|
|
|
|
|
2021-09-02 09:58:05 +00:00
|
|
|
# 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"
|
2022-04-11 15:26:17 +00:00
|
|
|
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 = {}
|
2022-04-11 15:26:17 +00:00
|
|
|
|
|
|
|
# Make it possible to hide courses by default from the studio
|
|
|
|
SEARCH_SKIP_SHOW_IN_CATALOG_FILTERING = False
|
2021-09-02 09:58:05 +00:00
|
|
|
|
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 }}",
|
|
|
|
}
|
|
|
|
|
2019-04-24 13:40:35 +00:00
|
|
|
# Create folders if necessary
|
2019-12-24 16:22:12 +00:00
|
|
|
for folder in [DATA_DIR, LOG_DIR, MEDIA_ROOT, STATIC_ROOT_BASE, ORA2_FILEUPLOAD_ROOT]:
|
2019-04-24 13:40:35 +00:00
|
|
|
if not os.path.exists(folder):
|
2022-04-23 15:21:17 +00:00
|
|
|
os.makedirs(folder, exist_ok=True)
|
2019-06-05 13:43:51 +00:00
|
|
|
|
|
|
|
{{ patch("openedx-lms-common-settings") }}
|
2019-10-17 08:22:04 +00:00
|
|
|
|
2021-04-13 20:14:43 +00:00
|
|
|
######## End of common LMS settings
|