Coder Social home page Coder Social logo

eeyhan / onlinestudy Goto Github PK

View Code? Open in Web Editor NEW
136.0 10.0 51.0 3.33 MB

一个在线教育方向的电商平台,附带视频加密播放功能,调用支付宝支付接口,遵循restful规范,主要使用Python3+django+vue+Element-UI

License: MIT License

Python 69.44% HTML 5.79% Vue 13.72% CSS 3.03% ASP 3.51% Java 0.89% PHP 3.63%

onlinestudy's Introduction

onlinestudy

利用django结合restful规范开发的一个在线视频教育平台,可播放,播放调用保利威加密视频,可购买,购买调用支付宝接口。 另内含一个后台管理平台,基于角色等级的控制,根据不同的角色有不同的菜单功能显示

更新进度:

  • 2019/07/18

    • 删除不必要的代码
    • 说明django自带的admin后台和本项目的后台的差别
    • 感谢给我star的兄弟们,后续会发布更多我自己开发的开源项目

开发环境

  • 后端:

    • django 2+
    • djangorestframework组件
    • python 3.7
  • 前端:

    • vue 2.5.2
    • webpack 3.6.0
    • Element-UI 2
  • 规范协议:

    • restful
    • PEP8协议
  • 数据库:

    • mysql(业务逻辑部分)
    • redis(持久化存储登录状态,商城数据)
  • 第三方组件/接口:

    • 支付宝支付接口
    • 极验验证码
    • 保利威加密视频
    • matplotlab数据可视化
    • kindeditor富文本编辑器
    • bootstrap-datepicker日期选择器

主要功能

  • 前端部分:
    • 在线播放视频(本项目中由于加密视频平台的测试账号有效期已过,目前无法播放)
    • 登录注册均调用极验验证码验证机制
    • 课程相关展示
    • 购物车、优惠券
    • 作业提交、问题提问、商品评价
  • 后端部分:
    • 采用restful规范,利用django的DRF组极简与前端分离并做数据交互
    • 与前端部分的数据存储使用redis永久存储
  • 后台部分:
    • 造了一个轮子 —— django-startX 快速实现后台权限管理
    • 造了一个轮子 —— django-rbac 快速完成根据角色不同做不同的功能权限限制
    • 利用matplotlab模块,对注册用户、账单进行数据分析形成趋势图

数据库、账户相关

  • 本项目不附带数据库源数据,自行配置数据库,在后端部分的根目录onlinestudy/onlinestudy/settings.py文件配置数据库,以下为mysql数据库的配置

DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'HOST': '主机地址(IP地址)', 'PORT': '数据库端口', 'USER': '账户名', 'PASSWORD': '密码', 'NAME': '数据库名', # 'OPTIONS': { # 'init_command': "SET sql_mode='STRICT_TRANS_TABLES'", # }, } }

  • 终端下进入后端部分的根目录onlinestudy,使用如下命令迁移数据库

python manage.py makemigrations python manage.py migrate

  • 迁移之后自行创建数据库,根据自己的数据库账号密码进行登录验证

  • 以下为本项目的登录界面:

本项目后台

  • 登录成功界面:

本项目后台

  • django自带admin组件后台如下(该后台可以做快速处理,并不是本项目的后台)

django自带后台

  • 登录成功界面: django自带后台

  • 所有django自带admin组件后台的测试用户的密码都是123

  • django自带admin组件后台的超级用户账户:root/123456

程序流程图

启动项目之前

  • 后端部分请按照根目录的requirements.txt文件安装必须的第三方依赖

    • 安装命令

    pip install -r requirements.txt

  • 前端部分请进入根目录,运行如下命令安装必须的第三方依赖

    • 前提请自行安装node.js

    npm install

启动项目

后端部分:

进入后端根目录onlinestudy
python manage.py runserver 127.0.0.1:8000 (启动地址随意)

自动转化代码为PEP8规范

进入后端根目录onlinestudy

``autopep8 --in-place --aggressive --aggressive onlinestudy ``

单元测试

进入后端根目录onlinestudy

``python manage.py test ``

前端部分:

进入前端端根目录onlinestudy

开发环境:npm run dev
生产环境:npm run bulid

启动之后的界面展示

由于数据来源后端动态显示,所以无法在线展示,以下是图片展示

  • 前端部分

    首页

    首页

    底部

    课程

    • 并且课程支持按标签,按热度,价格高低筛选

    课程部分

    • 滑到中下部自动出现购物车和回顶部的悬浮按钮

    高级课程

    课程详情部分

    课程详情部分

    购买部分

    • 如果未登录就会跳到登录页面

    登录页面

    注册页面

    登录之后进入首页

    购物车

    结算中心

    选择优惠券

    支付宝支付

    我的订单页面

    学习中心部分,课程课时

    作业页面

    • 由于我的保利威测试账户有效期已过,所以无法正常显示视频

    视频播放页面

  • 后端部分

    后台登录页面

    后台首页

    菜单列表

    权限批量分配页面

    账单列表

    账单报表

    用户列表

    • 富文本插件的使用

    资讯管理

    • datepicker的使用

    datepicker

    注册用户分析

    角色列表

    角色功能分配

    学生列表

    课程列表

    课程详情列表

个人的技术文章请移步:博客文章

onlinestudy's People

Contributors

eeyhan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

onlinestudy's Issues

rbac 无法创建表

(env) G:\work\pythonproject\OnlineStudy>python manage.py migrate
Traceback (most recent call last):
File "manage.py", line 15, in
execute_from_command_line(sys.argv)
File "G:\work\pythonproject\env\lib\site-packages\django\core\management_init_.py", line 381, in execute_from_command_line
utility.execute()
File "G:\work\pythonproject\env\lib\site-packages\django\core\management_init_.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "G:\work\pythonproject\env\lib\site-packages\django\core\management\base.py", line 316, in run_from_argv
self.execute(*args, **cmd_options)
File "G:\work\pythonproject\env\lib\site-packages\django\core\management\base.py", line 353, in execute
output = self.handle(*args, **options)
File "G:\work\pythonproject\env\lib\site-packages\django\core\management\base.py", line 83, in wrapped
res = handle_func(*args, **kwargs)
File "G:\work\pythonproject\env\lib\site-packages\django\core\management\commands\migrate.py", line 82, in handle
executor = MigrationExecutor(connection, self.migration_progress_callback)
File "G:\work\pythonproject\env\lib\site-packages\django\db\migrations\executor.py", line 18, in init
self.loader = MigrationLoader(self.connection)
File "G:\work\pythonproject\env\lib\site-packages\django\db\migrations\loader.py", line 49, in init
self.build_graph()
File "G:\work\pythonproject\env\lib\site-packages\django\db\migrations\loader.py", line 270, in build_graph
raise exc
File "G:\work\pythonproject\env\lib\site-packages\django\db\migrations\loader.py", line 244, in build_graph
self.graph.validate_consistency()
File "G:\work\pythonproject\env\lib\site-packages\django\db\migrations\graph.py", line 243, in validate_consistency
[n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)]
File "G:\work\pythonproject\env\lib\site-packages\django\db\migrations\graph.py", line 243, in
[n.raise_error() for n in self.node_map.values() if isinstance(n, DummyNode)]
File "G:\work\pythonproject\env\lib\site-packages\django\db\migrations\graph.py", line 96, in raise_error
raise NodeNotFoundError(self.error_message, self.key, origin=self.origin)
django.db.migrations.exceptions.NodeNotFoundError: Migration generic.0001_initial dependencies reference nonexistent parent node ('rbac', '0001_initial')

应该是版本不对,下面是对应的版本:
Package Version


alipay-sdk-python 3.3.92
attrs 19.1.0
Automat 0.7.0
autopep8 1.4.4
backports.csv 1.0.7
certifi 2019.6.16
chardet 3.0.4
constantly 15.1.0
cycler 0.10.0
defusedxml 0.6.0
diff-match-patch 20181111
Django 2.1
django-cors-headers 3.0.2
django-import-export 1.2.0
django-simpleui 2.1.5
djangorestframework 3.10.2
et-xmlfile 1.0.1
geetest 3.2.1
hyperlink 19.0.0
idna 2.8
incremental 17.5.0
jdcal 1.4.1
kiwisolver 1.1.0
matplotlib 3.1.1
numpy 1.17.0
oauthlib 3.1.0
odfpy 1.4.0
openpyxl 2.6.2
pandas 0.25.0
Pillow 6.1.0
pip 19.2.1
pyasn1 0.4.6
pycodestyle 2.5.0
pycrypto 2.6.1
pycryptosat 0.2.0
PyHamcrest 1.9.0
PyJWT 1.7.1
PyMySQL 0.9.3
pyparsing 2.4.2
python-dateutil 2.8.0
python3-openid 3.1.0
pytz 2019.2
PyYAML 5.1.2
redis 3.3.6
requests 2.22.0
requests-oauthlib 1.2.0
rsa 4.0
setuptools 28.8.0
six 1.12.0
social-auth-app-django 3.1.0
social-auth-core 3.2.0
sqlparse 0.3.0
tablib 0.13.0
Twisted 19.2.1
urllib3 1.25.3
xlrd 1.2.0
xlwt 1.3.0
zope.interface 4.6.0

后台用户无法登录

您好好,后台管理页面我用root:123455登录不上,去DB里面查了auth_user表是空的,请问怎么添加后台管理的账户呢~

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.