主要是参考官方教程
做些记录,备忘.
###create superuser
1
2
3
|
cd /edx/app/edxapp/edx-platform
sudo -u www-data /edx/bin/python.edxapp ./manage.py lms --settings aws create_user -e wwj@qq.com
sudo -u www-data /edx/bin/python.edxapp ./manage.py lms --settings aws changepassword wwj
|
###登陆到django后台 /admin
####承上
1
2
3
4
5
6
|
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="wwj")
me.is_superuser = True
me.is_staff = True
me.save()
|
定制主题应当放到汉化之前,否则汉化会被覆盖.原因是定制主题中设计更新代码.
###定制主题
参考here
采用手动编译
参考Stanford-Theming
theme-name统一用stanford
命名统一用小写
更深度的定制,需要修改模板mako.
关于mako:
###汉化
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
cd /edx/app/edxapp/edx-platform
:::text
sudo apt-get install transifex-client
vim ~/.transifexrc
[https://www.transifex.com]
hostname = https://www.transifex.com
username = user
password = pass
token =
chmod o+rw ~/.transifexrc
sudo -u edxapp bash
source /edx/app/edxapp/edxapp_env
cd /edx/app/edxapp/edx-platform
vim ../lms.env.json
"USE_I18N": true, #新增
"LANGUAGE_CODE": "zh_CN"
vim ../cms.env.json
"USE_I18N": true, #新增
"LANGUAGE_CODE": "zh_CN"
tx pull -l zh_CN
paver i18n_generate
paver update_assets lms --settings aws
paver update_assets cms --settings aws
exit
sudo /edx/bin/supervisorctl -c /edx/etc/supervisord.conf restart edxapp:
|
###邮件
在(*)ms.env.json中添加:
1
2
3
4
|
:::text
"EMAIL_HOST": "smtp.qq.com",
"EMAIL_PORT": 25,
"EMAIL_USE_TLS": true,
|
注意将"DEFAULT_FROM_EMAIL"改为你自己的邮箱,否则无法发送
在(*)ms.auth.json适当位置处添加:
1
2
3
|
:::text
"EMAIL_HOST_USER": "*****",
"EMAIL_HOST_PASSWORD":"*****",
|
重启edxapp
1
2
3
|
:::text
sudo /edx/bin/supervisorctl -c /edx/etc/supervisord.conf restart edxapp:
sudo /edx/bin/supervisorctl -c /edx/etc/supervisord.conf restart edxapp_worker:
|
单步调试
1
2
3
4
5
|
:::text
sudo -u www-data /edx/app/edxapp/venvs/edxapp/bin/python ./manage.py lms --settings aws shell
from django.core.mail import send_mail
send_mail(u'邮件标题', u'邮件内容', '123@qq.com', ['456@qq.com'],
fail_silently=False)
|
成功了~
###日志
/var/log/mail.log 邮件
/edx/var/log/
###反向代理
studio
nginx反向代理。studio.example.com指向studio
###定制主题
诸如IONISx,修改完less之后,删除static/main.css,执行grunt.
之后还要recompile the LMS assets.
less需要编译,而templates可以直接改,立刻生效,就是说theme的路径是在搜索路径中的,并不需要将文件复制进去。theme可以多个。按名字启用。
####静态文件
静态文件可以考虑先丢在外部,避免牵扯static
###拓展edx,添加自己的django app
setting环境默认是env/aws.py,许多设置在common.py里
注意模板的特殊性,使用的是mako,而不是django自带的。
每次修改完,需要
sudo /edx/bin/supervisorctl -c /edx/etc/supervisord.conf restart edxapp:
###使用自己的edx-platform
修改这里.
configuration,最近一次使用的是14-7-2