美文网首页
superset安装搭建及配置

superset安装搭建及配置

作者: daawen | 来源:发表于2018-09-28 12:22 被阅读0次

    安装:

    安装依赖包
    $ 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虚拟环境搭建
    $ python3.6 -m venv
    $ source venv/bin/activate
    
    开始安装,网络不好会失败,可以先wget下来再安装
    $ pip install pandas
    $ pip install superset
    如果是0.27最新版,需要降低markdown版本
    $ pip install "markdown<3.0.0" superset
    
    连接mysql数据库
    $ pip install pymysql
    

    配置:

    创建管理员用户
    $ fabmanager create-admin --app superset
    
    初始化数据库
    $ superset db upgrade
    
    载入示例数据
    $ superset load_examples
    
    创建默认用户角色权限
    $ superset init
    
    在6060端口运行开发模式
    $ superset runserver -d -p 6060
    
    数据源中设置为:
    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文件里自己建一个配置文件并引入环境
    $ 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图的数字格式等:

    $ 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
    
    
    

    回头继续补充

    相关文章

      网友评论

          本文标题:superset安装搭建及配置

          本文链接:https://www.haomeiwen.com/subject/twvuoftx.html