Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in
Toggle navigation
T
tamp_course_order
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
彭熊
tamp_course_order
Commits
d9ecb56e
Commit
d9ecb56e
authored
Dec 13, 2020
by
pengxiong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
跨域问题
parent
87b8ce80
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
6 deletions
+13
-6
engine.py
app/api/engine.py
+6
-6
errorhandler.py
app/controller/errorhandler.py
+7
-0
No files found.
app/api/engine.py
View file @
d9ecb56e
...
...
@@ -32,9 +32,9 @@ tamp_user_engine = create_engine(
charset
=
"utf8"
),
max_overflow
=
0
,
# 超过连接池大小外最多创建的连接
pool_size
=
10
0
,
# 连接池大小
pool_size
=
2
0
,
# 连接池大小
pool_timeout
=
5
,
pool_recycle
=
60
0
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
=
10
0
,
# 连接池大小
pool_size
=
2
0
,
# 连接池大小
pool_timeout
=
5
,
pool_recycle
=
60
0
pool_recycle
=
60
)
tamp_zhibo_engine
=
create_engine
(
...
...
@@ -61,9 +61,9 @@ tamp_zhibo_engine = create_engine(
charset
=
"utf8"
),
max_overflow
=
0
,
# 超过连接池大小外最多创建的连接
pool_size
=
10
0
,
# 连接池大小
pool_size
=
2
0
,
# 连接池大小
pool_timeout
=
5
,
pool_recycle
=
60
0
pool_recycle
=
60
)
redis
=
redis
.
Redis
(
...
...
app/controller/errorhandler.py
View file @
d9ecb56e
...
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment