Superset深度汉化以及框架使用

编译messages.po文件
pybabel compile -d translations

修改config文件

# ---------------------------------------------------
# Babel config for translations
# ---------------------------------------------------
# Setup default language
BABEL_DEFAULT_LOCALE = 'zh'
# Your application default translation path
BABEL_DEFAULT_FOLDER = 'babel/translations'
# The allowed translation for you app
LANGUAGES = {
     'en': {'flag': 'us', 'name': 'English'},
    #'it': {'flag': 'it', 'name': 'Italian'},
    # 'fr': {'flag': 'fr', 'name': 'French'},
     'zh': {'flag': 'cn', 'name': 'Chinese'},
}

可详见Flask AppBuilder文档

http://flask-appbuilder.readthedocs.io/en/latest/_modules/flask_appbuilder/baseviews.html?highlight=description_columns

Sqlalchemy文档

http://docs.sqlalchemy.org/en/latest/core/tutorial.html

SuperSet深度汉化

  SuperSet前段修改需要重新打包需要npm run build或者npm run dev

  因为在supersetstaticassets路径下package.json
   "test": "mocha --require ignore-styles --compilers js:babel-core/register --require spec/helpers/browser.js --recursive spec/**/*_spec.*",
    "cover": "babel-node node_modules/.bin/babel-istanbul cover _mocha -- --require spec/helpers/browser.js --recursive spec/**/*_spec.*",
    "dev": "NODE_ENV=dev webpack --watch --colors --progress --debug --output-pathinfo --devtool inline-source-map",
    "dev-fast": "NODE_ENV=dev webpack --watch --colors --progress --debug --output-pathinfo --devtool eval-cheap-source-map",
    "prod": "NODE_ENV=production node --max_old_space_size=4096 ./node_modules/webpack/bin/webpack.js -p --colors --progress",
    "build": "NODE_ENV=production webpack --colors --progress",
    "lint": "eslint --ignore-path=.eslintignore --ext .js,.jsx .",
    "sync-backend": "babel-node --presets es2015 javascripts/syncBackend.js"

  npm run xxx:执行package.json,xxx可以在”scripts”中找到,build、prod之类的都是自己配的。每当执行npm run,就会自动新建一个 Shell,在这个 Shell 里面执行指定的脚本命令。会生成dist目录,即压缩之后的js文件目录,其中webpack –watch为监听页面变动并自动打包

sync-backend方式打包

$ node --version
   v7.9.0
$ npm --version
   4.2.0
$ cd superset/assets/
$ yarn --version
   0.27.5
$ yarn
$ npm run sync-backend
$ npm run prod
$ npm run dev
原文地址:https://www.cnblogs.com/Jonecmnn/p/7551793.html