Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
credit-report-api
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
QA
credit-report-api
Commits
b8307955
Commit
b8307955
authored
Aug 23, 2019
by
张鹏程
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改上传文件bug
parent
682406c9
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
55 additions
and
41 deletions
+55
-41
settings.py
config/settings.py
+11
-6
ReportAnalysis_Handler.py
handler/ReportAnalysis_Handler.py
+4
-3
UpLoadFiles_Handler.py
handler/UpLoadFiles_Handler.py
+13
-3
startup.py
startup.py
+27
-29
No files found.
config/settings.py
View file @
b8307955
import
os
from
tornado.options
import
options
FILE_PATH
=
os
.
path
.
realpath
(
os
.
curdir
)
FEATURE_HOST
=
'http://172.20.1.131:23010'
FEATURE_HOST_MY
=
'http://localhost:23010'
url_reportanalysis
=
'/report'
url_uploadfiles
=
'/uploadfiles'
settings
=
{
'debug'
:
options
.
debug
}
# TO_JSON = FILE_PATH+'/to_json'
# HTML_PATH = FILE_PATH+'/html'
TO_JSON
=
'/home/sysprd/credit-report-api/to_json'
HTML_PATH
=
'/home/sysprd/credit-report-api/html'
if
settings
[
'debug'
]:
TO_JSON
=
FILE_PATH
+
'/to_json'
HTML_PATH
=
FILE_PATH
+
'/html'
else
:
TO_JSON
=
'/home/sysprd/credit-report-api/to_json'
HTML_PATH
=
'/home/sysprd/credit-report-api/html'
handler/ReportAnalysis_Handler.py
View file @
b8307955
...
...
@@ -42,13 +42,14 @@ class ReportAnalysis(BaseHandler):
'TransactionDetails'
,
'QueryInfomation'
]
# maxconnections =
len(asslysis)
#最大并发数
# maxconnections =
1
#最大并发数
# semlock = threading.BoundedSemaphore(maxconnections)
# t = []
# for i in range(maxconnections):
# semlock.acquire()
# t
= threading.Thread(target=eval(asslysis[i]),args=(html.menu_dict,
))
# t
.append(threading.Thread(target=eval(asslysis[i]),args=(html.menu_dict,)
))
# semlock.release()
# t.start()
# t
[i]
.start()
PersonalInformation
(
html
.
menu_dict
)
InformationSummary
(
html
.
menu_dict
)
TransactionDetails
(
html
.
menu_dict
)
...
...
handler/UpLoadFiles_Handler.py
View file @
b8307955
...
...
@@ -3,8 +3,16 @@
from
utils
import
JsonUtil
from
handler.Base_Handler
import
BaseHandler
from
config
import
settings
import
os
class
UpLoadFiles
(
BaseHandler
):
def
get
(
self
):
file_list
=
os
.
listdir
(
settings
.
HTML_PATH
)
self
.
write
(
JsonUtil
.
build_json
(
code
=
JsonUtil
.
Constants
.
Code_Success
,
mssage
=
JsonUtil
.
Constants
.
Msg_Success
,
report
=
{
'文件列表'
:
file_list
}
))
self
.
flush
()
self
.
finish
()
def
post
(
self
):
# self._filepath = self.get_arguments('filepath', default=None)
try
:
...
...
@@ -42,8 +50,8 @@ class UpLoadFiles(BaseHandler):
# report='文件上传成功'
# ))
# f.close()
self
.
flush
()
self
.
finish
()
self
.
flush
()
self
.
finish
()
except
IOError
as
e
:
print
(
e
)
...
...
@@ -61,3 +69,5 @@ class UpLoadFiles(BaseHandler):
mssage
=
JsonUtil
.
Constants
.
Msg_Params_Error
.
format
(
'文件名称不存在'
,
file_name
)))
self
.
flush
()
startup.py
View file @
b8307955
...
...
@@ -9,17 +9,14 @@ from tornado.ioloop import IOLoop
import
tornado.log
import
logging
import
tornado.options
from
config
import
settings
as
URL
# from handler import LoanDueRateHandler
from
tornado.options
import
define
,
options
from
tornado.options
import
options
,
define
define
(
"port"
,
default
=
20010
,
help
=
"run on the given port "
,
type
=
int
)
# define("log_path", default='/tmp', help="log path ", type=str)
define
(
"debug"
,
default
=
True
,
help
=
"enable debug mode"
)
tornado
.
options
.
parse_command_line
()
from
config
import
settings
from
handler
import
ReportAnalysis_Handler
,
UpLoadFiles_Handler
from
tornado.options
import
define
,
options
define
(
"port"
,
default
=
20010
,
help
=
"run on the given port "
,
type
=
int
)
define
(
"log_path"
,
default
=
'/tmp'
,
help
=
"log path "
,
type
=
str
)
class
LogFormatter
(
tornado
.
log
.
LogFormatter
):
def
__init__
(
self
):
...
...
@@ -30,27 +27,28 @@ class LogFormatter(tornado.log.LogFormatter):
)
def
apps
():
return
Application
([
(
URL
.
url_reportanalysis
,
ReportAnalysis_Handler
.
ReportAnalysis
),
(
URL
.
url_uploadfiles
,
UpLoadFiles_Handler
.
UpLoadFiles
),
(
settings
.
url_reportanalysis
,
ReportAnalysis_Handler
.
ReportAnalysis
),
(
settings
.
url_uploadfiles
,
UpLoadFiles_Handler
.
UpLoadFiles
),
])
]
,
**
settings
.
settings
)
if
__name__
==
"__main__"
:
app
=
apps
(
)
server
=
HTTPServer
(
app
)
[
i
.
setFormatter
(
LogFormatter
())
for
i
in
logging
.
getLogger
()
.
handlers
]
tornado
.
options
.
parse_command_line
(
)
# #== 本地调试
app
.
listen
(
20011
)
IOLoop
.
instance
()
.
start
()
#
tornado.options.parse_command_line()
#
app = apps()
#
http_server = tornado.httpserver.HTTPServer(app)
#
http_server.bind(options.port)
#
http_server.start()
#
tornado.ioloop.IOLoop.instance().start()
debug
=
options
.
debug
print
(
debug
)
if
debug
:
app
=
apps
()
server
=
HTTPServer
(
app
)
[
i
.
setFormatter
(
LogFormatter
())
for
i
in
logging
.
getLogger
()
.
handlers
]
# #== 本地调试
app
.
listen
(
20011
)
IOLoop
.
instance
()
.
start
()
else
:
tornado
.
options
.
parse_command_line
()
app
=
apps
()
http_server
=
tornado
.
httpserver
.
HTTPServer
(
app
)
http_server
.
bind
(
options
.
port
)
http_server
.
start
()
tornado
.
ioloop
.
IOLoop
.
instance
()
.
start
()
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