Commit c9da61e3 authored by 张鹏程's avatar 张鹏程

增加加密规则

parent dd2f5a7a
Pipeline #926 failed with stages
......@@ -13,11 +13,14 @@ import config.settings as URL
from handler import UserRegister_Handler
from tornado.options import define, options
define("port", default=21000, help="run on the given port ", type=int)
define("debug", default=True, help="is debug", type=bool)
define("log_path", default='/tmp', help="log path ", type=str)
options.parse_command_line()
class LogFormatter(tornado.log.LogFormatter):
def __init__(self):
print('%(color)s[%(asctime)s %(filename)s:%(funcName)s:%(lineno)d %(levelname)s]%(end_color)s %(message)s')
super(LogFormatter, self).__init__(
fmt='%(color)s[%(asctime)s %(filename)s:%(funcName)s:%(lineno)d %(levelname)s]%(end_color)s %(message)s',
datefmt='%Y-%m-%d %H:%M:%S'
......@@ -30,24 +33,19 @@ def apps():
if __name__ == "__main__":
if options:
app = apps()
server = HTTPServer(app)
[i.setFormatter(LogFormatter()) for i in logging.getLogger().handlers]
tornado.options.parse_command_line()
# #== 本地调试
app.listen(23010)
app.listen(21000)
IOLoop.instance().start()
#
# from tornado.options import define, options
# define("port", default=23010, help="run on the given port ", type=int)
# define("log_path", default='/tmp', help="log path ", type=str)
# tornado.options.parse_command_line()
# app = apps()
# http_server = tornado.httpserver.HTTPServer(app)
# http_server.bind(options.port)
# http_server.start(num_processes=0)
# tornado.ioloop.IOLoop.instance().start()
else:
app = apps()
http_server = tornado.httpserver.HTTPServer(app)
http_server.bind(options.port)
http_server.start()
tornado.ioloop.IOLoop.instance().start()
......@@ -3,9 +3,7 @@
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"scrolled": true
},
"metadata": {},
"outputs": [
{
"name": "stdout",
......@@ -62,9 +60,7 @@
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"scrolled": true
},
"metadata": {},
"outputs": [
{
"data": {
......@@ -73,8 +69,8 @@
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result",
"metadata": {}
}
],
"source": [
......@@ -96,7 +92,9 @@
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
"source": [
""
]
}
],
"metadata": {
......@@ -108,7 +106,7 @@
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
"version": 3.0
},
"file_extension": ".py",
"mimetype": "text/x-python",
......
......@@ -34,8 +34,8 @@ def decrypt(text):
return bytes.decode(plain_text).rstrip('\0')
#
# if __name__ == '__main__':
# e = encrypt("量化派用户") # 加密
# d = decrypt(e) # 解密
# print("加密:", e)
# print("解密:", d)
\ No newline at end of file
if __name__ == '__main__':
e = encrypt("量化派用户") # 加密
d = decrypt(e) # 解密
print("加密:", e)
print("解密:", d)
\ No newline at end of file
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