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

    1. 先安装python-geohash,本机安装时报错如下:

image

从https://visualstudio.microsoft.com/zh-hans/visual-cpp-build-tools/下载工具安装,安装的工具如下

image

  1. 接着安装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即可
  2. 重新执行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"#默认中文
  • 完全汉化

    1. pip instal pybabel
    2. 项目根路径执行 pybabel compile -d .\superset\translations\编译汉化文件
  • 编译前台资源

    1. 使用nvm管理node版本,nvm install 18
    2. nvm use 18
    3. 进入superset-frontend文件夹执行npm installnpm run build,如果没有问题的话,生成的静态文件在superset/static文件夹
  • 接着参照官网命令依次执行

# 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
posted @   _fun_ny  阅读(638)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 微软正式发布.NET 10 Preview 1:开启下一代开发框架新篇章
· DeepSeek “源神”启动!「GitHub 热点速览」
· C# 集成 DeepSeek 模型实现 AI 私有化(本地部署与 API 调用教程)
· DeepSeek R1 简明指南:架构、训练、本地部署及硬件要求
· NetPad:一个.NET开源、跨平台的C#编辑器
点击右上角即可分享
微信分享提示
主题色彩