liqian 2 years ago
parent
commit
386f810960
2 changed files with 29 additions and 2 deletions
  1. 27 0
      app.py
  2. 2 2
      config.py

+ 27 - 0
app.py

@@ -1,4 +1,5 @@
 import random
+import logging
 
 from gevent import monkey
 monkey.patch_all()
@@ -22,8 +23,34 @@ from user2new import user2new
 from params_helper import Params
 # from werkzeug.middleware.profiler import ProfilerMiddleware
 
+# import sentry_sdk
+# from sentry_sdk.integrations.flask import FlaskIntegration
+#
+# sentry_sdk.init(
+#     dsn="https://3960f1cb8cbe49768f77efcfdbdcec50@o1288299.ingest.sentry.io/6504932",
+#     integrations=[
+#         FlaskIntegration(),
+#     ],
+#
+#     # Set traces_sample_rate to 1.0 to capture 100%
+#     # of transactions for performance monitoring.
+#     # We recommend adjusting this value in production.
+#     traces_sample_rate=1.0,
+#
+#     # By default the SDK will try to use the SENTRY_RELEASE
+#     # environment variable, or infer a git commit
+#     # SHA as release, however you may want to set
+#     # something more human-readable.
+#     # release="myapp@1.0.0",
+# )
 
 app = Flask(__name__)
+
+# handler = logging.FileHandler('app.log', encoding='utf-8')
+# logging_format = logging.Formatter('%(asctime)s - %(levelname)s - %(filename)s- %(funcName)s - %(lineno): %(message)s')
+# handler.setFormatter(logging_format)
+# app.logger.addHandler(handler)
+
 #app.wsgi_app = ProfilerMiddleware(app.wsgi_app)
 log_ = Log()
 config_ = set_config()

+ 2 - 2
config.py

@@ -560,8 +560,8 @@ class ProductionConfig(BaseConfig):
 
 def set_config():
     # 获取环境变量 ROV_SERVER_ENV
-    env = os.environ.get('ROV_SERVER_ENV')
-    # env = 'dev'
+    # env = os.environ.get('ROV_SERVER_ENV')
+    env = 'dev'
     if env is None:
         # log_.error('ENV ERROR: is None!')
         return