西麦农场

时间尺度守恒


  • 首页

  • 分类

  • 归档

  • 坑List

Supervisor+Virtualenv+ Gunicorn部署Python项目时supervisor的配置文件

2019-08-01 | DevFAQ | python Gunicorn Virtualenv

配置文件如下

  1. [program:api]
  2. environment=PATH="/project/absolute/path/venv/bin:%(ENV_PATH)s"
  3. command=gunicorn -b 127.0.0.1:4567 app:app

其他配置都省略了,这里面核心配置是『environment』,就是给要运行项目添加一个单独的环境变量,保证可以争取调用venv下的包。

附上全部配置文件:supervisord.conf

  1. [unix_http_server]
  2. file=/tmp/supervisor.sock
  3. [supervisord]
  4. logfile=/opt/logs/supervisord.log
  5. logfile_maxbytes=50MB
  6. logfile_backups=10
  7. loglevel=info
  8. pidfile=/tmp/supervisord.pid
  9. nodaemon=false
  10. minfds=1024
  11. minprocs=200
  12. [rpcinterface:supervisor]
  13. supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
  14. [supervisorctl]
  15. serverurl=unix:///tmp/supervisor.sock
  16. [program:api]
  17. directory = /home/webuser/webapps/iteam/app
  18. environment=PATH="/home/webuser/webapps/iteam/app/venv/bin:%(ENV_PATH)s"
  19. command=gunicorn -b 127.0.0.1:4567 --access-logfile /home/webuser/logs/iteam/api-access.log --error-logfile /home/webuser/logs/iteam/api-error.log app:app
  20. user=root
  21. autostart=true
  22. autorestart=true
  23. redirect_stderr=false
  24. stdout_logfile=/home/webuser/logs/iteam/api-stdout.log
  25. stderr_logfile=/home/webuser/logs/iteam/api-stderr.log
  26. stdout_logfile_maxbytes=50MB
  27. stdout_logfile_backups=10
  28. stdout_capture_maxbytes=1MB
  29. stdout_events_enabled=false
  • 目录
  • 站点概览
  • 配置文件如下
  • 附上全部配置文件:supervisord.conf
    戊在西安填坑中

    戊在西安填坑中

    29 日志
    7 分类
    50 标签
    0%
    © 2017- 戊在西安填坑中 | 陕ICP备13008306号-3 | 主题 NexT.Pisces