6
0
mirror of https://github.com/ChristianLight/tutor.git synced 2025-01-06 07:30:40 +00:00

Fix profile image upload

Media file upload, such as video files or profile images, were uploaded
to /edx/var/edxapp/media because the MEDIA_ROOT setting is defined in
common.py.

Close #54.
This commit is contained in:
Régis Behmo 2018-08-27 23:19:16 +02:00
parent 75fa18267f
commit 75d7ee688b
2 changed files with 13 additions and 1 deletions

View File

@ -15,3 +15,8 @@ import os
for folder in [LOG_DIR, MEDIA_ROOT, STATIC_ROOT_BASE]:
if not os.path.exists(folder):
os.makedirs(folder)
# Fix media files paths
VIDEO_IMAGE_SETTINGS['STORAGE_KWARGS']['location'] = MEDIA_ROOT
VIDEO_TRANSCRIPTS_SETTINGS['STORAGE_KWARGS']['location'] = MEDIA_ROOT
PROFILE_IMAGE_BACKEND['options']['location'] = os.path.join(MEDIA_ROOT, 'profile-images/')

View File

@ -1,8 +1,9 @@
import os
from ..aws import *
# Load module store settings from config files
update_module_store_settings(MODULESTORE, doc_store_settings=DOC_STORE_CONFIG)
# Set uploaded media file path
MEDIA_ROOT = "/openedx/data/uploads/"
# Change syslog-based loggers which don't work inside docker containers
@ -10,10 +11,16 @@ LOGGING['handlers']['local'] = LOGGING['handlers']['console'].copy()
LOGGING['handlers']['tracking'] = LOGGING['handlers']['console'].copy()
# Create folders if necessary
import os
for folder in [LOG_DIR, MEDIA_ROOT, STATIC_ROOT_BASE]:
if not os.path.exists(folder):
os.makedirs(folder)
# Fix media files paths
VIDEO_IMAGE_SETTINGS['STORAGE_KWARGS']['location'] = MEDIA_ROOT
VIDEO_TRANSCRIPTS_SETTINGS['STORAGE_KWARGS']['location'] = MEDIA_ROOT
PROFILE_IMAGE_BACKEND['options']['location'] = os.path.join(MEDIA_ROOT, 'profile-images/')
ALLOWED_HOSTS = [
ENV_TOKENS.get('LMS_BASE'),
FEATURES['PREVIEW_LMS_BASE'],