gen_conf.py 613 B

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