Your Name 3 years ago
parent
commit
b3bbbcea3d
1 changed files with 23 additions and 0 deletions
  1. 23 0
      designer/gen_conf.py

+ 23 - 0
designer/gen_conf.py

@@ -0,0 +1,23 @@
+#!/usr/bin/python3
+import os
+import codecs
+import dataset
+
+
+def proc_file(content):
+    fw=codecs.open('/etc/nginx/six/six.conf','w','utf-8')
+    fw.write(content)
+    fw.close()
+
+db = dataset.connect('mysql://hhh7796hhh:lYmWsu^ujcA1@hhh-v57-cluster.cluster-cmab1ctkglka.ap-northeast-2.rds.amazonaws.com:3306/xoops?charset=utf8mb4')
+
+cursor=db.query('SELECT hdesigner_id FROM xoops._hdesigner where onoff=1; ')
+content=""
+for c in cursor:
+    did=c['hdesigner_id']
+    print(did)
+    content+=" location ^~ /six/"+str(did)+"/ { \n"
+    content+=" alias /var/www/jared-six/"+str(did)+"/; }\n"
+
+
+proc_file(content)