openedx docker

小组项目: 首先从git上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

编译事项

  1. 用户及密码 sudo -H -u edxapp bash exit passwd edxapp 输入密码,并重复一遍

  2. 修改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 //回到原权限

  3. 进入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.LmsSearchResultProcessor
SEARCH_FILTER_GENERATOR: lms.lib.courseware_search.lms_filter_generator.LmsSearchFilterGenerator

常用操作

  1. 创建django管理员,用户名为huang sudo -u www-data /edx/bin/python.edxapp ./manage.py lms --settings aws create_user -s -p edx -e huang@example.com 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()

  2. 将edx-platform/conf/locale/zh_cn/LC_MESSAGES目录下的*.po编译为*.mo cd ~/edx-platform django-admin.py compilemessages

  3. 日志目录 /edx/var/log/cms/edx.log

连接pycharm

具体可以参考以下文档,使用pycharm连接openedx
另外以下是笔者配置可以参考。
笔者的配置

注意事项

  1. 如果不是出于折腾的目的,不要轻易升级docker中的python、pip、xmodule等等。

参考

使用docker开发调试opendex open简明配置指南 更新国际化

转载于:https://my.oschina.net/htzy/blog/849013

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值