gunicorn_config.py 745 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. import os
  4. import json
  5. import multiprocessing
  6. __author__ = 'James Iter'
  7. __date__ = '2017/2/20'
  8. __contact__ = 'james.iter.cn@gmail.com'
  9. __copyright__ = '(c) 2017 by James Iter.'
  10. with open('/etc/jimvc.conf', 'r') as f:
  11. _config = json.load(f)
  12. log_file_dir = os.path.dirname(_config['log_file_path'])
  13. if not os.path.isdir(log_file_dir):
  14. os.makedirs(log_file_dir, 0755)
  15. bind = _config['listen'] + ':' + _config['port'].__str__()
  16. workers = multiprocessing.cpu_count() * 2 + 1
  17. worker_class = 'eventlet'
  18. worker_connections = 1000
  19. daemon = True
  20. accesslog = '/'.join([log_file_dir, 'access.log'])
  21. errorlog = '/'.join([log_file_dir, 'error.log'])
  22. loglevel = 'info'
  23. pidfile = './jimid.pid'