forked from joofio/chat-with-epi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.py
31 lines (25 loc) · 800 Bytes
/
run.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import logging
import os
from logging.handlers import RotatingFileHandler
from chat_app import app
if not app.debug:
# if app.debug:
if not os.path.exists("logs"):
try:
os.mkdir("logs")
except FileExistsError:
print("The 'logs' directory already exists.")
file_handler = RotatingFileHandler(
"logs/lens-summary.log", maxBytes=10240 * 1024, backupCount=10
)
file_handler.setFormatter(
logging.Formatter(
"%(asctime)s %(levelname)s: %(message)s [in %(pathname)s:%(lineno)d]"
)
)
file_handler.setLevel(logging.INFO)
app.logger.addHandler(file_handler)
app.logger.setLevel(logging.INFO)
if __name__ == "__main__":
# print("runnn")
app.run(debug=True, host="0.0.0.0", port=5005)