gen_conf.py 814 B

123456789101112131415161718192021222324252627
  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_ext.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+=" location ^~ /d2/"+str(did)+"/ { \n"
  18. content+=" add_header Access-Control-Allow-Origin *; \n"
  19. content+=" alias /var/www/jared-six/"+str(did)+"/; }\n"
  20. proc_file(content)