:art: os.remove

huangqimin001 5 years ago
parent
commit
92eeaae64b
1 changed files with 5 additions and 2 deletions
  1. 5 2
      commands/management/commands/qiniu.py

+ 5 - 2
commands/management/commands/qiniu.py

@@ -1,6 +1,7 @@
1 1
 # -*- coding: utf-8 -*-
2 2
 
3 3
 import logging
4
+import os
4 5
 
5 6
 from django_six import CompatibilityBaseCommand, close_old_connections
6 7
 
@@ -16,10 +17,10 @@ logger = logging.getLogger('console')
16 17
 class Command(CompatibilityBaseCommand):
17 18
     def handle(self, *args, **options):
18 19
 
19
-        logger.info('SubscribeUserInfo is dealing')
20
+        logger.info('Upload image qiniu is dealing')
20 21
 
21 22
         while True:
22
-            # r.rpushjson('SUBSCRIBE_USERINFO_LIST', {
23
+            # r.rpushjson('QINIU_UPLOAD_LIST', {
23 24
             #    'model': 'SaleclerkSubmitLogInfo',
24 25
             #    'pk': 'pk',
25 26
             # })
@@ -42,12 +43,14 @@ class Command(CompatibilityBaseCommand):
42 43
                 if ssli.image:
43 44
                     try:
44 45
                         upload_file_path(ssli.image.path, key=ssli.image.name, bucket='tamron')
46
+                        os.remove(ssli.image.path)
45 47
                     except:
46 48
                         pass
47 49
 
48 50
                 if ssli.code_image:
49 51
                     try:
50 52
                         upload_file_path(ssli.code_image.path, key=ssli.code_image.name, bucket='tamron')
53
+                        os.remove(ssli.code_image.path)
51 54
                     except:
52 55
                         pass
53 56