Superset Windows二次开发环境搭建
截止到2024.08.20最新版本是4.0.2
-
拉取代码仓库
https://github.com/apache/superset.git
-
切换到当前最新的Tag:4.0.2
git checkout 4.0.2
-
使用conda管理Python环境,本次使用的python为3.9
-
参考官方文档
pip install -r requirements/development.txt
时会报错,主要是两个依赖安装报错python-geohash和python-ldap- 先安装python-geohash,本机安装时报错如下:
从https://visualstudio.microsoft.com/zh-hans/visual-cpp-build-tools/下载工具安装,安装的工具如下
- 接着安装python-ladp,这里使用预编译方式安装,从https://github.com/cgohlke/python-ldap-build/下载3.9版本.whl文件,我安装的是:https://github.com/cgohlke/python-ldap-build/releases/download/v3.4.4/python_ldap-3.4.4-cp39-cp39-win_amd64.whl 这个仓库可能是保留最新的两个版本,所以要和superset需要的版本对应,项目中使用的版本在
requirements/development.txt
指定,我安装的是3.4.4,自行修改版本或者直接下载文件中对应的版本,接着执行命令pip install python_ldap-3.4.4-cp39-cp39-win_amd64.whl
即可 - 重新执行
pip install -r requirements/development.txt
-
项目根路径执行
pip install -e .
-
在项目根路径创建
superset_config.py
,配置SUPERSET_CONFIG_PATH
环境变量指向该文件,文件内容如下
SECRET_KEY="BW9X7p/Ei02hJ/87h9VahNoiZi2xN+0frl0spvCMngIT0I/2mGrmPqCc" #openssl rand -base64 42自己生成
SQLALCHEMY_DATABASE_URI=""#配置自己的数据库连接
BABEL_DEFAULT_LOCALE = "zh"#默认中文
-
完全汉化
pip instal pybabel
- 项目根路径执行
pybabel compile -d .\superset\translations\
编译汉化文件
-
编译前台资源
- 使用nvm管理node版本,
nvm install 18
nvm use 18
- 进入
superset-frontend
文件夹执行npm install
和npm run build
,如果没有问题的话,生成的静态文件在superset/static
文件夹
- 使用nvm管理node版本,
-
接着参照官网命令依次执行
# Initialize the database
superset db upgrade
# Create an admin user in your metadata database (use `admin` as username to be able to load the examples)
superset fab create-admin
# Create default roles and permissions
superset init
# Load some data to play with.
# Note: you MUST have previously created an admin user with the username `admin` for this command to work.
superset load-examples
# Start the Flask dev web server from inside your virtualenv.
# Note that your page may not have CSS at this point.
# See instructions below how to build the front-end assets.
superset run -p 8088 --with-threads --reload --debugger --debug
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 微软正式发布.NET 10 Preview 1:开启下一代开发框架新篇章
· DeepSeek “源神”启动!「GitHub 热点速览」
· C# 集成 DeepSeek 模型实现 AI 私有化(本地部署与 API 调用教程)
· DeepSeek R1 简明指南:架构、训练、本地部署及硬件要求
· NetPad:一个.NET开源、跨平台的C#编辑器