#!/usr/bin/python3 import os import codecs import dataset def proc_file(content): fw=codecs.open('/etc/nginx/six/six_ext.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+=" location ^~ /designers/cases/"+str(did)+"/1-page/new-sort/ { \n" content+=" location ^~ /d2/"+str(did)+"/ { \n" content+=" add_header Access-Control-Allow-Origin *; \n" content+=" alias /var/www/jared-six/"+str(did)+"/; }\n" proc_file(content)