平台管理
1.列出所有manage.py命令参数:
sudo
-u www-data
/edx/app/edxapp/venvs/edxapp/bin/python
/edx/app/edxapp/edx-platform/manage
.py lms --settings aws help
2.重启edxapp
sudo
/edx/bin/supervisorctl
restart edxapp:
以前的版本使用:
sudo
/edx/bin/supervisorctl
-c
/edx/etc/supervisord
.conf edxapp:
3.查看服务器状态:
sudo
/edx/bin/supervisorctl
status
4.创建一个名为”user”超级管理员(django-admin):
sudo
-u www-data
/edx/bin/python
.edxapp .
/manage
.py lms --settings aws create_user -s -p edx -e user@example.com
sudo
-u www-data
/edx/bin/python
.edxapp .
/manage
.py lms --settings aws changepassword user
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=
"user"
)
me.is_superuser = True
me.is_staff = True
me.save()
5.以dubug模式启动lms:
cd
/edx/app/edxapp/edx-platform
sudo
-u www-data
/edx/bin/python
.edxapp .
/manage
.py lms runserver 8000 --settings aws
ip:8000可访问
6.重建数据库表结构
sudo
su
edxapp -s
/bin/bash
cd
~
source
edxapp_env
python
/edx/app/edxapp/edx-platform/manage
.py lms
/cms
syncdb --migrate --settings=aws
(lms
/cms
二选一)
7.编译lms静态文件
sudo
-H -u edxapp
bash
source
/edx/app/edxapp/edxapp_env
cd
/edx/app/edxapp/edx-platform
paver update_assets lms --settings aws
编译cms只要将lms改成cms既可。
课程管理
1.从github导入一门课程(以/edx-demo为例)
cd
/var/tmp
git clone https:
//github
.com
/edx/edx-demo-course
.git
cd
/edx/app/edxapp/edx-platform
sudo
-u www-data
/edx/bin/python
.edxapp .
/manage
.py cms --settings=aws
import
/edx/var/edxapp/data
/var/tmp/edx-demo-course
2.删除一门课程(cypress版本):
sudo
-u www-data
/edx/bin/python
.edxapp .
/manage
.py cms --settings=aws delete_course course-v1:Organization+CourseNumber+CourseRun commit
course-v1:Organization+CourseNumber+CourseRun为课程
以前的版本使用:
sudo
-u www-data
/edx/bin/python
.edxapp .
/manage
.py cms --settings=aws delete_course Organization
/CourseNumber/CourseRun
commit
如果删除失败可从数据库删除:
#列出所有课程
mongo
use edxapp
db.modulestore.
find
( {
"_id.category"
:
"course"
}, {
'name'
:
'1'
} )
#删除课程代码为999的课程
db.modulestore.remove({
'_id.course'
:
'999'
})
3.删除一个邮箱为”user@example.com”的账户
sudo
-u www-data
/edx/bin/python
.edxapp .
/manage
.py lms --settings aws shell
from django.contrib.auth.models
import
User
u=User.objects.get(email=
"user@example.com"
); [obj.delete()
for
obj
in
u.preferences.all()];
u.delete()
或者
sudo
su
edxapp -s
/bin/bash
cd
~
source
edxapp_env
from django.contrib.auth.models
import
User
u=User.objects.get(email=
"user@example.com"
); [obj.delete()
for
obj
in
u.preferences.all()];
u.delete()