【发布时间】:2020-08-18 14:51:16
【问题描述】:
我正在尝试使用 gunicorn 和 nginx 为 Flask 提供服务 这是我的 systemd 单元配置文件
[Unit]
Description=Gunicorn instance to serve odooErp
After=network.target
[Service]
User=tito
Group=www-data
WorkingDirectory=/home/tito/peg/odoo_api/peg_api
Environment="PATH=/home/tito/peg/odoo_api/peg_api/env/bin"
ExecStart=/home/tito/peg/odoo_api/peg_api/env/bin/gunicorn --workers 3 --bind unix:odooErp.sock -m 007 wsgi:app
[Install]
WantedBy=multi-user.target
当我启动服务时,尽管使用 pip 安装了 gunicorn,但我遇到了以下错误
[0;1;31m●[0m odooErp.service - Gunicorn instance to serve productionOdoo
Loaded: loaded (/etc/systemd/system/odooErp.service; enabled; vendor preset: enabled)
Active: [0;1;31mfailed[0m (Result: exit-code) since Tue 2020-08-18 05:33:23 UTC; 1min 0s ago
Main PID: 18305 (code=exited, status=1/FAILURE)
CPU: 43ms
Aug 18 05:33:23 peg-test-01 systemd[1]: Started Gunicorn instance to serve odooErp.
Aug 18 05:33:23 peg-test-01 gunicorn[18305]: Traceback (most recent call last):
Aug 18 05:33:23 peg-test-01 gunicorn[18305]: File "/home/tito/peg/odoo_api/peg_api/env/bin/gunicorn", line 7, in <module>
Aug 18 05:33:23 peg-test-01 gunicorn[18305]: from gunicorn.app.wsgiapp import run
Aug 18 05:33:23 peg-test-01 gunicorn[18305]: ImportError: No module named 'gunicorn'
Aug 18 05:33:23 peg-test-01 systemd[1]: [0;1;39modooErp.service: Main process exited, code=exited, status=1/FAILURE[0m
Aug 18 05:33:23 peg-test-01 systemd[1]: [0;1;39modooErp.service: Unit entered failed state.[0m
Aug 18 05:33:23 peg-test-01 systemd[1]: [0;1;39modooErp.service: Failed with result 'exit-code'.[0m
【问题讨论】:
-
请检查您的环境中是否安装了 gunicorn
标签: python nginx flask gunicorn