中断训练
This commit is contained in:
@ -1,29 +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': 'sdust2020',
|
||||
'port': 6379,
|
||||
'database': 'school',
|
||||
'charset': 'utf8',
|
||||
'db': 0
|
||||
}
|
||||
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': 'sdust2020',
|
||||
'port': 6379,
|
||||
'database': 'school',
|
||||
'charset': 'utf8',
|
||||
'db': 0
|
||||
}
|
||||
|
@ -1,8 +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
|
||||
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
|
||||
|
@ -1,36 +1,44 @@
|
||||
"""
|
||||
@Time : 2022/11/15 10:13
|
||||
@Auth : 东
|
||||
@File :global_var.py
|
||||
@IDE :PyCharm
|
||||
@Motto:ABC(Always Be Coding)
|
||||
@Desc:
|
||||
|
||||
"""
|
||||
import json
|
||||
from app.utils.redis_config import redis_client
|
||||
|
||||
|
||||
def _init(): # 初始化
|
||||
dict = {}
|
||||
redis_client.__setattr__("_global_dict", json.dumps(dict))
|
||||
|
||||
|
||||
def set_value(key, value):
|
||||
# 定义一个全局变量
|
||||
dict = redis_client.get_redis().get("_global_dict")
|
||||
if dict is None:
|
||||
dict = {}
|
||||
dict[key] = value
|
||||
# redis_client.get_redis().set("_global_dict", json.dumps(dict))
|
||||
redis_client.__setattr__("_global_dict", json.dumps(dict))
|
||||
|
||||
|
||||
|
||||
def get_value(key):
|
||||
# 获得一个全局变量,不存在则提示读取对应变量失败
|
||||
try:
|
||||
return redis_client.get_redis().get("_global_dict")[key]
|
||||
except Exception as e:
|
||||
print(e)
|
||||
print('读取' + key + '失败\r\n')
|
||||
"""
|
||||
@Time : 2022/11/15 10:13
|
||||
@Auth : 东
|
||||
@File :global_var.py
|
||||
@IDE :PyCharm
|
||||
@Motto:ABC(Always Be Coding)
|
||||
@Desc:
|
||||
|
||||
"""
|
||||
import multiprocessing
|
||||
|
||||
|
||||
|
||||
def _init(): # 初始化
|
||||
# 中断标志
|
||||
global _global_dict
|
||||
_global_dict = {}
|
||||
|
||||
# # ws列表存储
|
||||
# global _active_connections
|
||||
# _active_connections = multiprocessing.Manager().list()
|
||||
|
||||
# # ws字典存储
|
||||
# global _active_connections_dist
|
||||
# _active_connections_dist = multiprocessing.Manager().dict()
|
||||
|
||||
|
||||
# def get_active_connections():
|
||||
# return _active_connections
|
||||
|
||||
# def get_active_connections_dist():
|
||||
# return _active_connections_dist
|
||||
|
||||
def set_value(key, value):
|
||||
# 定义一个全局变量
|
||||
_global_dict[key] = value
|
||||
|
||||
|
||||
def get_value(key):
|
||||
# 获得一个全局变量,不存在则提示读取对应变量失败
|
||||
try:
|
||||
return _global_dict[key]
|
||||
except:
|
||||
print('读取' + key + '失败\r\n')
|
||||
|
@ -1,3 +1,3 @@
|
||||
from .default import * # NOQA F401
|
||||
|
||||
DEBUG = False
|
||||
from .default import * # NOQA F401
|
||||
|
||||
DEBUG = False
|
||||
|
@ -1,14 +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)
|
||||
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