gen_conf.py 695 B

123456789101112131415161718192021222324
  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+=" location ^~ /designers/cases/"+str(did)+"/1-page/new-sort/ { \n"
  17. content+=" alias /var/www/jared-six/"+str(did)+"/; }\n"
  18. proc_file(content)