teaching开源少儿scratch编程教学平台部署搭建教程

源码准备

  • github下载
    http://github.com/open-scratch/teaching
  • gitee下载
    https://gitee.com/chengyu2333/teaching

设施准备

  1. 服务器,建议1核2G以上,宽带按量付费并调到最大
  2. 已备案域名,用于绑定七牛云存储,测试域名只有一个月时效。IP地址也可访问项目
  3. 七牛云存储并实名认证

环境和建议开发工具准备

  • jdk1.8
  • redis 3.2+
  • mysql5.7
  • nginx
  • IDEA unlimited
  • Visual Studio Code

后端

  1. 下载idea,安装Lombok Plugin插件
  2. 导入项目,选择 api/pom.xml即可导入先您过目
  3. 等待项目索引完毕,maven依赖下载完毕

  4. 修改配置application-dev.yml
    修改数据库、redis、七牛的配置

短信配置

  1. 配置阿里云短信密钥
    jeecg :

    短信秘钥

    sms:
    accessKeyId: ??
    accessKeySecret: ??

  2. 修改短信模板
    DySmsEnum.java

前端

  1. 下载node最新版,版本10.16以上
  2. 升级npm和webpack,方法自行搜索。建议使用yarn替代npm,安装方法自行搜索。
  3. 安装依赖 yarn install或npm install
  4. 修改public/index.html中的七牛根域名。如果不是华北区,还需要修改JUpload.vue和/public/scratch3/index.html中的上传区域。
    搜索关键词:upload-z0.qiniup.com和qiniu.region.z0
  5. 编译npm run build或直接运行npm run serve

nginx配置参考

server
{
    listen 80;
    server_name demo.teaching.vip;
    location / {
      index index.html index.htm;
      root /www/wwwroot/teaching;
      if (!-e $request_filename) {
          rewrite ^(.*)$ /index.html?s=$1 last;
          break;
      }
      gzip on;
      gzip_min_length 1k;
      gzip_comp_level 9;
      gzip_types text/plain application/javascript application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
      gzip_vary on;
      gzip_disable "MSIE [1-6]\.";
    }

    location ^~ /api
    {
    expires 12h;
    proxy_pass              http://127.0.0.1:8080/api/;
    proxy_set_header        Host 127.0.0.1;
    proxy_set_header        X-Real-IP $remote_addr;
    proxy_set_header        X-Forwarded-For $proxy_add_x_forwarded_for;
    add_header X-Cache $upstream_cache_status;
    add_header Cache-Control no-cache;
    }
}

前端常见错误和解决方案

  • node-sass未安装
gyp ERR! cwd /mnt/d/project/mine/teaching-release/web/node_modules/node-sass
gyp ERR! node -v v10.16.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
Build failed with error code: 1
npm WARN sass-loader@8.0.2 requires a peer of sass@^1.3.0 but none is installed. You must install peer dependencies yourself.
npm WARN sass-loader@8.0.2 requires a peer of fibers@>= 3.1.0 but none is installed. You must install peer dependencies yourself.

安装node-sass
npm i node-sass

  • 出现gyp xxxx的错误
gyp ERR! stack     at E (/mnt/d/project/mine/teaching-release/web/node_modules/which/which.js:80:29)
gyp ERR! stack     at /mnt/d/project/mine/teaching-release/web/node_modules/which/which.js:89:16
gyp ERR! stack     at /mnt/d/project/mine/teaching-release/web/node_modules/isexe/index.js:42:5

缺少node-gyp,安装
npm i node-gyp

  • 报错 These dependencies were not found
    缺少依赖,重新安装一遍
    npm install

后端常见问题和解决方案

  • MySQL数据库大小写问题

发表评论

[/0o0] [..^v^..] [0_0] [T.T] [=3-❤] [❤.❤] [^v^] [-.0] [!- -] [=x=] [→_→] [><] 更多 »
昵称

抢沙发~