setup.py 457 B

123456789101112131415161718192021
  1. import os
  2. import subprocess
  3. import time
  4. CWD = os.path.dirname(__file__)
  5. def start(args, logfile, errfile):
  6. subprocess.Popen(
  7. "$PY2_GUNICORN hello:app -c gunicorn_conf.py",
  8. cwd=CWD, stderr=errfile, stdout=logfile, shell=True)
  9. time.sleep(3)
  10. return 0
  11. def stop(logfile, errfile):
  12. subprocess.call(
  13. "kill `cat gunicorn.pid`",
  14. cwd=CWD, stderr=errfile, stdout=logfile, shell=True)
  15. time.sleep(3)
  16. return 0