王海庆的云笔记

部署one-workflow(作流管理系统)


关闭防火墙

systemctl stop firewalld
systemctl disable firewalld
sed -i -e  's/^SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config
setenforce 0


换成阿里云的源

rm -rf /etc/yum.repos.d/*
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
curl -o /etc/yum.repos.d/epel.repo https://mirrors.aliyun.com/repo/epel-7.repo
curl -o /etc/yum.repos.d/docker-ce.repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

yum clean all
yum makecache fast -y


公司里CentOS7的源

rm -rf /etc/yum.repos.d/*
cat >  /etc/yum.repos.d/centos7.repo << EOF
[base]
name=base
baseurl=http://172.18.0.61/centos7/base
enabled=1
gpgcheck=0

[extras]
name=extras
baseurl=http://172.18.0.61/centos7/extras
enabled=1
gpgcheck=0

[updates]
name=updates
baseurl=http://172.18.0.61/centos7/updates
enabled=1
gpgcheck=0

[epel]
name=epel
baseurl=http://172.18.0.61/centos7/epel
enabled=1
gpgcheck=0
EOF

yum clean all
yum makecache fast -y


 下载Node.js并安装

curl -L -o node-v12.22.3-linux-x64.tar.gz  https://cdn.npmmirror.com/binaries/node/v12.22.3/node-v12.22.3-linux-x64.tar.gz
tar zxvf node-v12.22.3-linux-x64.tar.gz -C /opt
 
ln -s /opt/node-v12.22.3-linux-x64/bin/node /usr/bin/node
ln -s /opt/node-v12.22.3-linux-x64/bin/npm /usr/bin/npm
ln -s /opt/node-v12.22.3-linux-x64/bin/npx /usr/bin/npx

# 改变默认下载地址
npm config set registry https://registry.npm.taobao.org


安装Python3

yum install python3 -y


下载代码

git clone https://codeload.github.com/itimor/one-workflow


需要修改的配置

vi one-workflow/frontend/vue.config.js
host: '0.0.0.0',

vi one-workflow/backend/core/settings/base.py
import os 
import pymysql 
pymysql.install_as_MySQLdb()

vi one-workflow/backend/core/settings/prod.py
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': os.path.join(BASE_DIR, '../core.db'),
    }
}


安装后端依赖

cd one-workflow/backend
pip3 install -r dev_requirements.txt -i https://mirrors.aliyun.com/pypi/simple/


初始化系统,生成管理员账号 admin/123456

python3 manage.py migrate
python3 manage.py init_sys


报错:django.core.exceptions.ImproperlyConfigured: SQLite 3.8.3 or later is required (found 3.7.17).

vi /usr/local/lib/python3.6/site-packages/django/db/backends/sqlite3/base.py

def check_sqlite_version(): 
    if Database.sqlite_version_info < (3, 6, 3): 
        raise ImproperlyConfigured('SQLite 3.6.3 or later is required (found %s).' % Database.sqlite_version)

修改为3.6.3即可

 

生成工作流 

python3 manage.py init_wf
python3 manage.py init_ticket
python3 manage.py init_leave
  • 用户 ops,ops_tl,dev,dev_tl,hr,hr_tl
  • 密码 123456

 

运行后端
python3 manage.py runserver 0.0.0.0:8000


 运行前端
# 安装依赖,否则npm install会报错
yum install gcc-c++ -y

cd one-workflow/frontend
npm install

# 如果报错node-sass相关错误信息,可以使用下面命令
npm install --registry=https://registry.npm.taobao.org --sass_binary_site=https://npm.taobao.org/mirrors/node-sass --unsafe-perm

# 如果报node-sass/vendor相关错误信息,可以使用下面命令
node node_modules/node-sass/scripts/install.js

npm run dev


访问

http://172.18.0.115:8080
admin/123456


one-workflow.zip


参考

https://codeload.github.com/itimor/one-workflow

文章最后更新时间: 2022-06-02 09:44:00