first commit
This commit is contained in:
0
app/configs/__init__.py
Normal file
0
app/configs/__init__.py
Normal file
29
app/configs/default.py
Normal file
29
app/configs/default.py
Normal file
@ -0,0 +1,29 @@
|
||||
import os
|
||||
|
||||
# 根目录
|
||||
ROOT_PATH = os.path.split(os.path.abspath(__name__))[0]
|
||||
# 开启debug
|
||||
DEBUG = True
|
||||
# 密钥
|
||||
SECRET_KEY = 'WugjsfiYBEVsiQfiSwEbIOEAGnOIFYqoOYHEIK'
|
||||
|
||||
# 数据库配置
|
||||
# SQLALCHEMY_DATABASE_URI = 'postgresql+psycopg2://deepLearner:dp2021@124.71.203.3:5432/demo'
|
||||
SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://demo:demo123@192.168.2.9:3306/flask_demo'
|
||||
SQLALCHEMY_TRACK_MODIFICATIONS = False
|
||||
# 查询时会显示原始SQL语句
|
||||
SQLALCHEMY_ECHO = True
|
||||
|
||||
# SQLALCHEMY_DATABASE_URI = 'sqlite:///{}'.format(os.path.join(ROOT_PATH, 'demo.db'))
|
||||
# SQLALCHEMY_TRACK_MODIFICATIONS = False
|
||||
|
||||
# 数据库配置
|
||||
db = {
|
||||
'host': '127.0.0.1',
|
||||
'user': 'root',
|
||||
'password': '',
|
||||
'port': 6379,
|
||||
'database': 'school',
|
||||
'charset': 'utf8',
|
||||
'db': 0
|
||||
}
|
8
app/configs/development.py
Normal file
8
app/configs/development.py
Normal file
@ -0,0 +1,8 @@
|
||||
from .default import * # NOQA F401
|
||||
|
||||
# 数据库配置
|
||||
SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://demo:demo123@192.168.2.9:3306/flask_demo'
|
||||
# SQLALCHEMY_DATABASE_URI = 'mysql+pymysql://demo:demo123@192.168.2.9:3306/flask_demo?allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai'
|
||||
SQLALCHEMY_TRACK_MODIFICATIONS = False
|
||||
# 查询时会显示原始SQL语句
|
||||
SQLALCHEMY_ECHO = True
|
3
app/configs/production.py
Normal file
3
app/configs/production.py
Normal file
@ -0,0 +1,3 @@
|
||||
from .default import * # NOQA F401
|
||||
|
||||
DEBUG = False
|
14
app/configs/testing.py
Normal file
14
app/configs/testing.py
Normal file
@ -0,0 +1,14 @@
|
||||
import os
|
||||
|
||||
from .default import ROOT_PATH
|
||||
from .default import * # NOQA F401
|
||||
|
||||
|
||||
TEST_BASE_DIR = os.path.join(ROOT_PATH, '.test')
|
||||
SQLALCHEMY_DATABASE_URI = 'sqlite:///{}'.format(
|
||||
os.path.join(TEST_BASE_DIR, 'demo.db'))
|
||||
# SQLALCHEMY_ECHO = True
|
||||
TESTING = True
|
||||
|
||||
if not os.path.exists(TEST_BASE_DIR):
|
||||
os.makedirs(TEST_BASE_DIR)
|
Reference in New Issue
Block a user