http://xjtupj.qcloudapps.com/pj/
基于Django Celery的后台挂机自动评教系统
本仓库代码可以直接在腾讯蓝鲸智云部署
- 要求使用
Python 2.x
- 按照
requirements.txt
中的需求使用pip
进行安装,例如pip install django==1.8.17
- 在
settings.py
中配置和数据库信息 - 执行
manage.py runserver
manage.py celery worker
manage.py celery beat
即可在http://127.0.0.1/pj/
访问
- 访问http://bk.tencent.com/campus/developer-center/
- 新建应用,并进行
SVN Checkout
trunk
- 直接删除
trunk
的所有数据,将本仓库的master
分支文件解压到该文件夹 - 执行
SVN Commit
。 - 在腾讯蓝鲸智云页面勾选
启用celery
和启用周期性任务
,点击一键部署应用即可
- 访问
/cas/login/
- 如果Session中有
cas
,则显示已登录,并在1秒后跳转到service的网址 - 如果Session中没有
cas
,则显示NetID、密码的输入框,这是一个简单的POST表单 - (同步)使用
requests
登录真·CAS
,如果成功则把用户名密码存到数据库,requests.Session
中的cookie转换为dict存到Session - 如果登录成功,与数据库原来密码不同记录更新密码,与原来密码相同则记录登录,不同则记录更新密码,原来没有用户则记录创建用户
- 访问
/ssfw/login/
- 如果没有师生服务的cookie则使用Session中的
cas
的cookie登录,如果也没有cas的cookie那就跳转到/cas/login/?redirect=/ssfw/login/
登录CAS - CAS登录成功之后,跳转回
/ssfw/login/
使用CAS登录师生服务,(同步)使用requests
登录真·师生服务
,返回一个跳转链接,使用新的requests.Session
访问此链接,然后把cookie存到Session中的ssfw
中 - 登录成功后记录CAS授权登录和师生服务登录
- 访问
/pj/login/
登录(并不是登录,而是爬取页面并缓存到Session中) - 访问
/pj/
显示缓存下来的爬取到的教学评价页面的信息 - 后台登录之后会添加此用户自动评教的
celery task
- 另一个进程中
celery beat
会每天依次尝试登录评教用户表所有用户,如果登录失败则将用户标记为失效,如果成功则自动评教(只评还没评的课程) - 用户自动评教有锁。防止两个线程同时评教
本项目仅供学习交流使用,代码采用AGPL-3.0开放源代码协议,欢迎Fork或发送Pull Request,如果喜欢可以点一下Star。
Django XJTU Teaching Evalution
Copyright (C) 2017 Ganlv
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.