1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
# Superset specific config
ROW_LIMIT = 5000
#SUPERSET_WEBSERVER_PORT = 8088
# Flask App Builder configuration
# Your App secret key will be used for securely signing the session cookie
# and encrypting sensitive information on the database
# Make sure you are changing this key for your deployment with a strong key.
# You can generate a strong key using `openssl rand -base64 42`
'''
使用命令“openssl rand -base64 42”创建SECRET_KEY填写到下面'''
SECRET_KEY = ''
# The SQLAlchemy connection string to your database backend
# This connection defines the path to the database that stores your
# superset metadata (slices, connections, tables, dashboards, ...).
# Note that the connection information to connect to the datasources
# you want to explore are managed directly in the web UI
'''
数据库连接,我是用的是MySQL数据库
链接字符串:mysql+pymysql://<数据库用户>:<密码>@<主机名/ip>/<数据库名>'''
SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://superset:superset@hadoop01:3306/superset?charset=utf8'
ENABLE_CSRF_PROTECTION = True
# Flask-WTF flag for CSRF
WTF_CSRF_ENABLED = True
WTF_CSRF_CHECK_DEFAULT = True
# Add endpoints that need to be exempt from CSRF protection
#WTF_CSRF_EXEMPT_LIST = []
# A CSRF token that expires in 1 year
#WTF_CSRF_TIME_LIMIT = 60 * 60 * 24 * 365
#不填这个会出现登录界面输入正确的用户名和密码后登录无反应的现象
#但是关掉这个可能会降低安全性,可能是superset版本太新(3.0.0),旧版本貌似没有这个问题
TALISMAN_ENABLED=False
# Set this API key to enable Mapbox visualizations
MAPBOX_API_KEY = ''
COMPRESS_REGISTER = False
#默认中文
BABEL_DEFAULT_LOCALE = "zh"
#superset支持的语言
LANGUAGES = {
"en": {"flag": "us", "name": "English"},
"es": {"flag": "es", "name": "Spanish"},
"it": {"flag": "it", "name": "Italian"},
"fr": {"flag": "fr", "name": "French"},
"zh": {"flag": "cn", "name": "Chinese"},
"ja": {"flag": "jp", "name": "Japanese"},
"de": {"flag": "de", "name": "German"},
"pt": {"flag": "pt", "name": "Portuguese"},
"pt_BR": {"flag": "br", "name": "Brazilian Portuguese"},
"ru": {"flag": "ru", "name": "Russian"},
"ko": {"flag": "kr", "name": "Korean"},
"sk": {"flag": "sk", "name": "Slovak"},
"sl": {"flag": "si", "name": "Slovenian"},
"nl": {"flag": "nl", "name": "Dutch"},
}
SHOW_STACKTRACE = False
DEBUG = False
APP_NAME = "Superset"
#不填这个会导致报错如下
#ModuleNotFoundError: No module named 'MySQL_db'
SQLALCHEMY_TRACK_MODIFICATIONS = False
import logging
LOG_LEVEL = 'DEBUG' # 设置日志级别为DEBUG可以获得最详细的日志信息
LOG_FILE = '/home/rust/superset/superset_logfile.log' # 指定日志文件路径
logging.basicConfig(
filename=LOG_FILE,
level=LOG_LEVEL,
format='%(asctime)s %(levelname)s %(name)s %(threadName)s : %(message)s',
)
|