windows Superset 1.4.0本地源码部署


# 需要提前布置好 python 虚拟环境 、visualStudio工具、 本地电脑安装 Node.js

# 官方安装文档

https://superset.apache.org/docs/intro

# 下载源码

https://github.com/apache/superset/tree/latest

# 切换到superset/superset/config.py 根据需求进行更改元数据库 这里我更改的为mysql

# The SQLAlchemy connection string.
# SQLALCHEMY_DATABASE_URI = "sqlite:///" + os.path.join(DATA_DIR, "superset.db")
SQLALCHEMY_DATABASE_URI = 'mysql://root:password@localhost:3306/superset?charset=UTF8'
# SQLALCHEMY_DATABASE_URI = 'postgresql://root:password@localhost/myapp'

# superset 根目录下

pip install -e .
pip install mysqlclient

# 初始化数据库

superset db upgrade

# 声明变量

set FLASK_APP=superset

# 创建用户

superset fab create-admin

注意:三个名字必须不不同,如果配置同一个会报权限错误!!!

# 初始化

superset init

# 生成 package.json 文件

npm init

# 切换到 superset/superset-frontend下 修改webpack.config.js

{
test: /\.jsx?$/,
// include source code for plugins, but exclude node_modules and test files within them
exclude: [/superset-ui.*\/node_modules\//, /\.test.jsx?$/],
include: [
new RegExp(`${APP_DIR}/src`),
/superset-ui.*\/src/,
new RegExp(`${APP_DIR}/.storybook`),
/@encodable/,
path.resolve(__dirname, 'src'), // 添加本行代码,对 windows 环境不友好
],
use: [babelLoader],
},

# 切换到 superset/superset-frontend下

npm install
npm run build
npm run dev

# npm依赖 切换到superset/static/assets

npm install --force

# 运行

superset run -p 8088 --with-threads --reload --debugger

参考: https://blog.csdn.net/qq_39945938/article/details/121268001