From a72592e27696e73ff67dbc2fc9d7a79b1c17d940 Mon Sep 17 00:00:00 2001 From: Keigo Habara Date: Sat, 8 Sep 2018 15:45:17 +0900 Subject: [PATCH 1/2] add script to move icon from DB to public-folder --- webapp/public/move_image.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 webapp/public/move_image.py diff --git a/webapp/public/move_image.py b/webapp/public/move_image.py new file mode 100644 index 00000000..dc310938 --- /dev/null +++ b/webapp/public/move_image.py @@ -0,0 +1,12 @@ +import MySQLdb + +# conn = MySQLdb.connect(db='isubata',user='root',passwd='password',charset='utf8mb4') +conn = MySQLdb.connect(db='isubata',user='root') +c = conn.cursor() +#tableが既にある場合は一回削除します +c.execute('SELECT name,data FROM image') +for row in c.fetchall(): + f = open('icons/' + row[0],'wb') + f.write(row[1]) + f.close() +conn.close() From 5409cb979385e63d886b4bd489c9a4bdc65684cc Mon Sep 17 00:00:00 2001 From: Keigo Habara Date: Sat, 8 Sep 2018 15:53:53 +0900 Subject: [PATCH 2/2] remove comment --- webapp/public/move_image.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/webapp/public/move_image.py b/webapp/public/move_image.py index dc310938..38738a26 100644 --- a/webapp/public/move_image.py +++ b/webapp/public/move_image.py @@ -1,9 +1,7 @@ import MySQLdb -# conn = MySQLdb.connect(db='isubata',user='root',passwd='password',charset='utf8mb4') conn = MySQLdb.connect(db='isubata',user='root') c = conn.cursor() -#tableが既にある場合は一回削除します c.execute('SELECT name,data FROM image') for row in c.fetchall(): f = open('icons/' + row[0],'wb')