Commit d9ecb56e authored by pengxiong's avatar pengxiong

跨域问题

parent 87b8ce80
......@@ -32,9 +32,9 @@ tamp_user_engine = create_engine(
charset="utf8"
),
max_overflow=0, # 超过连接池大小外最多创建的连接
pool_size=100, # 连接池大小
pool_size=20, # 连接池大小
pool_timeout=5,
pool_recycle=600
pool_recycle=60
)
tamp_pay_engine = create_engine(
......@@ -46,9 +46,9 @@ tamp_pay_engine = create_engine(
password=config[env]['MySQL']['password'],
charset="utf8"),
max_overflow=0, # 超过连接池大小外最多创建的连接
pool_size=100, # 连接池大小
pool_size=20, # 连接池大小
pool_timeout=5,
pool_recycle=600
pool_recycle=60
)
tamp_zhibo_engine = create_engine(
......@@ -61,9 +61,9 @@ tamp_zhibo_engine = create_engine(
charset="utf8"
),
max_overflow=0, # 超过连接池大小外最多创建的连接
pool_size=100, # 连接池大小
pool_size=20, # 连接池大小
pool_timeout=5,
pool_recycle=600
pool_recycle=60
)
redis = redis.Redis(
......
......@@ -66,6 +66,7 @@ def add_errorhandler(app):
def before_request():
# token鉴权
# 安卓,ios取token
print(request.headers)
token = ''
if request.headers.get('env') in ['ios', 'android']:
token = request.headers.get('tampToken', '')
......@@ -86,4 +87,10 @@ def add_errorhandler(app):
@app.after_request
def after_request(response):
response.headers['Access-Control-Allow-Origin'] = '*'
response.headers['Access-Control-Allow-Methods'] = 'PUT,GET,POST,DELETE,OPTIONS'
response.headers['Access-Control-Allow-Headers'] = (
"Content-Type,Referer,Accept,Origin,User-Agent"
"field,Cache-Control,X-Requested-With"
)
return response
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment