未验证 提交 5c14a72f 编写于 作者: Y Yan Chunwei 提交者: GitHub

Merge pull request #20 from jacquesqiao/init_python

""" entry point of visual_dl
"""
import json
from optparse import OptionParser
from flask import Flask
from flask import request
from visualdl.log import logger
app = Flask(__name__)
def option_parser():
"""
:return:
"""
parser = OptionParser(usage="usage: visual_dl visual_dl.py "\
"-p port [options]")
parser.add_option(
"-p",
"--port",
default=8040,
action="store",
dest="port",
help="rest api service port")
return parser.parse_args()
# return data
# status, msg, data
def gen_result(status, msg):
"""
:param status:
:param msg:
:return:
"""
result = dict()
result['status'] = status
result['msg'] = msg
result['data'] = {}
return result
@app.route('/')
def index():
"""
:return:
"""
result = gen_result(0, "Hello, this is VisualDL!")
return json.dumps(result)
if __name__ == '__main__':
options, args = option_parser()
logger.info(" port=" + str(options.port))
app.run(debug=False, host="0.0.0.0", port=options.port)
from setuptools import setup
setup(name="visualdl",
version="0.0.1",
packages=['visualdl'],
include_package_data=True,
install_requires=[
'flask>=0.12.1'
],
url='http://www.baidu.com/',
license='Apache 2.0',
)
import log
__all__ = [
'log'
]
import logging
logger = logging
logger.basicConfig(
format='[%(levelname)s %(asctime)s %(filename)s:%(lineno)s] %(message)s')
logger.getLogger().setLevel(logging.INFO)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册