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

增加加密规则

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