Browse Source

日志打印

pengzhibo168 5 năm trước cách đây
mục cha
commit
1e06218355
3 tập tin đã thay đổi với 26 bổ sung18 xóa
  1. 12 4
      AnsjerPush/local_settings.py
  2. 3 3
      AnsjerPush/test_settings.py
  3. 11 11
      Controller/DetectController.py

+ 12 - 4
AnsjerPush/local_settings.py

@@ -65,7 +65,7 @@ WSGI_APPLICATION = 'AnsjerPush.wsgi.application'
 DATABASE_DATA = 'AnsjerLocal'
 SERVER_HOST = '192.168.136.45'
 DATABASES_USER = 'ansjer'
-DATABASES_PASS = '1234'
+DATABASES_PASS = 'ansjer.x.x'
 
 DATABASES = {'default': {
     'ENGINE': 'django.db.backends.mysql',
@@ -172,7 +172,8 @@ LOGGING = {
             'formatter': 'error_format',
         },
         'console': {
-            'level': 'ERROR',
+            # 'level': 'ERROR',
+            'level': 'DEBUG',
             'class': 'logging.StreamHandler',
             'formatter': 'error_format'
         },
@@ -181,8 +182,15 @@ LOGGING = {
         'django': {
             'handlers': ['default', 'console'],
             # 'handlers': ['mail_admins','default','console'],
-            'level': 'ERROR',
-            'propagate': False
+            # 'level': 'ERROR',
+            'level': 'DEBUG',
+            'propagate': True
         },
+        # 'django.db.backends': {
+        #     'handlers': ['console'],
+        #     'propagate': True,
+        #     'level': 'DEBUG',
+        # },
     }
 }
+

+ 3 - 3
AnsjerPush/test_settings.py

@@ -164,7 +164,7 @@ LOGGING = {
             'formatter': 'error_format',
         },
         'console': {
-            'level': 'ERROR',
+            'level': 'DEBUG',
             'class': 'logging.StreamHandler',
             'formatter': 'error_format'
         },
@@ -173,8 +173,8 @@ LOGGING = {
         'django': {
             'handlers': ['default', 'console'],
             # 'handlers': ['mail_admins','default','console'],
-            'level': 'ERROR',
-            'propagate': False
+            'level': 'DEBUG',
+            'propagate': True
         },
     }
 }

+ 11 - 11
Controller/DetectController.py

@@ -387,17 +387,17 @@ class NotificationView(View):
         push.platform = jpush.all_
         res = push.send()
         return res.status_code
-        try:
-            res = push.send()
-            print(res)
-        except Exception as e:
-            print("jpush fail")
-            print("Exception")
-            print(repr(e))
-            return
-        else:
-            print("jpush success")
-            return
+        # try:
+        #     res = push.send()
+        #     print(res)
+        # except Exception as e:
+        #     print("jpush fail")
+        #     print("Exception")
+        #     print(repr(e))
+        #     return
+        # else:
+        #     print("jpush success")
+        #     return
 
     def do_fcm(self, uid, channel, appBundleId, token_val, event_type, n_time, msg_title, msg_text):
         try: