小组项目: 首先从上clone一份代码,我的代码放在/Users/huangshihe/edx/edx-platform,可以自己更改,另外docker镜像近几天会上传的。
运行docker代码
# 导出镜像docker save 镜像名 > /home/save.tar # 导入镜像docker load < /home/save.tar # 创建容器docker run --name bigfour2 --privileged=true -itd -p 5000:5000 -p 5010:5010 -p 2022:22 -p 80:80 -p 18010:18010 -v /Users/huangshihe/edx/edx-platform:/edx/app/edxapp/edx-platform huangshihe/edx:0.1
编译事项
-
用户及密码 sudo -H -u edxapp bash exit passwd edxapp 输入密码,并重复一遍
-
修改sudoer # chmod u+w /etc/sudoers //赋予写权限 # ls -al /etc/sudoers //查看权限 # vim /etc/sudoers //编辑 在root ALL=(ALL:ALL) ALL下加edxapp ALL=(ALL) ALL :wq # chmod u-w /etc/sudoers //回到原权限
-
进入edxapp用户编译 # sudo -H -u edxapp bash $ source /edx/app/edxapp/edxapp_env $ cd /edx/app/edxapp/edx-platform $ paver update_assets cms --settings=aws $ paver update_assets lms --settings=aws $ python manage.py cms --settings=aws collectstatic --noinput $ python manage.py lms --settings=aws collectstatic --noinput
$ sudo /edx/bin/supervisorctl restart edxapp:
搜索设置
1. 修改cms
1.1 增加或修改~/cms.env.json
ENABLE_COURSEWARE_INDEX: true ENABLE_LIBRARY_INDEX:true
1.2 修改~/edx-platform/cms/envs/common.py
SEARCH_ENGINE: "search.elastic.ElasticSearchEngine" ELASTIC_FIELD_MAPPINGS = { "start_date": { "type": "date" } }
2. 修改lms
####2.1 增加或修改lms.env.json
ENABLE_COURSEWARE_INDEX: true ENABLE_LIBRARY_INDEX: true ENABLE_COURSEWARE_SEARCH: true ENABLE_DASHBOARD_SEARCH: true ENABLE_COURSE_DISCOVERY: true // 首页搜索 COURSE_DISCOVERY_FILTERS: If provided, overrides the list of facets that are used in the Course Discovery feature to filter the results. By default, all facets will be displayed. The list of available facets includes: Course organization: "org" Course type: "modes" Course language: "language"
####2.2 修改common.py
SEARCH_ENGINE: search.elastic.ElasticSearchEngine SEARCH_INITIALIZER:lms.lib.courseware_search.lms_search_initializer.LmsSearchInitializer SEARCH_RESULT_PROCESSOR: lms.lib.courseware_search.lms_result_processor.LmsSearchResultProcessorSEARCH_FILTER_GENERATOR: lms.lib.courseware_search.lms_filter_generator.LmsSearchFilterGenerator
常用操作
-
创建django管理员,用户名为huang sudo -u www-data /edx/bin/python.edxapp ./manage.py lms --settings aws create_user -s -p edx -e sudo -u www-data /edx/bin/python.edxapp ./manage.py lms --settings aws changepassword huang sudo -u www-data /edx/bin/python.edxapp ./manage.py lms --settings aws shell from django.contrib.auth.models import User me = User.objects.get(username="huang") me.is_superuser = True me.is_staff = True me.save() exit()
-
将edx-platform/conf/locale/zh_cn/LC_MESSAGES目录下的*.po编译为*.mo cd ~/edx-platform django-admin.py compilemessages
-
日志目录 /edx/var/log/cms/edx.log
连接pycharm
具体可以参考以下文档,
另外以下是笔者配置可以参考。注意事项
- 如果不是出于折腾的目的,不要轻易升级docker中的python、pip、xmodule等等。
参考