superset安裝搭建及配置

安裝:

安裝依賴包
$ sudo apt-get install build-essential libssl-dev libffi-dev python-dev python-pip libsasl2-dev libldap2-dev
或
$ yum -y upgrade python-setuptools
$ yum -y install gcc gcc-c++ libffi-devel python-devel python-pip python-wheel openssl-devel libsasl2-devel openldap-devel

venv虛擬環(huán)境搭建
$ python3.6 -m venv
$ source venv/bin/activate

開始安裝,網(wǎng)絡不好會失敗,可以先wget下來再安裝
$ pip install pandas
$ pip install superset
如果是0.27最新版,需要降低markdown版本
$ pip install "markdown<3.0.0" superset

連接mysql數(shù)據(jù)庫
$ pip install pymysql

配置:

創(chuàng)建管理員用戶
$ fabmanager create-admin --app superset

初始化數(shù)據(jù)庫
$ superset db upgrade

載入示例數(shù)據(jù)
$ superset load_examples

創(chuàng)建默認用戶角色權限
$ superset init

在6060端口運行開發(fā)模式
$ superset runserver -d -p 6060

數(shù)據(jù)源中設置為:
mysql+pymysql://superset:密碼@IP地址:3306/huiyun?charset=utf8

后臺運行及關閉

$ nohup superset runserver -p 6060& 
$ ps -ef | grep superset
$ kill 9 進程號

配置文件

直接編輯配置文件
$ vi ./lib/python3.6/site-packages/superset/config.py 

或在home文件里自己建一個配置文件并引入環(huán)境
$ export PYTHONPATH=/home/daawen/.superset/:$PYTHONPATH

superset_config.py文件里進行一些定制:

# ---------------------------------------------------------
# Superset specific config
# ---------------------------------------------------------
ROW_LIMIT = 5000
SUPERSET_WEBSERVER_PORT = 6060

# Setup default language 
BABEL_DEFAULT_LOCALE = 'en' 
# Your application default translation path
BABEL_DEFAULT_FOLDER = 'superset/translations' 
# The allowed translation for you app 
LANGUAGES = {
        'en': {'flag': 'us', 'name': 'English'} ,
        'zh': {'flag': 'cn', 'name': 'Chinese'},
        }

# ---------------------------------------------------
# Roles config
# ---------------------------------------------------
# Grant public role the same set of permissions as for the GAMMA role.
# This is useful if one wants to enable anonymous users to view
# dashboards. Explicit grant on specific datasets is still required.
PUBLIC_ROLE_LIKE_GAMMA = True

# ------------------------------
# GLOBALS FOR APP Builder
# ------------------------------
# Uncomment to setup Your App name
APP_NAME = 'Superset'

# Uncomment to setup an App icon
APP_ICON = '/static/assets/images/superset-logo@2x.png'

資源文件修改,例如修改pie圖的數(shù)字格式等:

$ cd superset/static/assets/
$ sudo apt install nodejs
$ sudo apt install npm
$ sudo npm install npm@latest -g
$ sudo npm install -g n

$ npm install -g yarn
$ yarn

# Start a watcher that recompiles your assets as you modify them (reload your browser to see changes)
npm run dev

# Compile the Javascript and CSS in production/optimized mode for official releases
npm run prod

# Copy a conf file from the frontend to the backend
npm run sync-backend

其他

反向編譯語言文件,即 mo -> po
$  msgfmt xxx.mo -o xxx.po


回頭繼續(xù)補充

最后編輯于
?著作權歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容