search

Home  >  Q&A  >  body text

python - supervisor控制台运行出错,BACKOFF Exited too quickly

运行系统为Ubuntu15,虚拟环境已激活,相关依赖包已安装程序正常运行;但外部环境没有安装相关依赖。
这是配置文件说明

这是配置命令

这是配置文件内容。

程序正常运行

启动控制台时出现错误:BACKOFF Exited too quickly (process log may have details).

错误日志

命令执行历史

============================================
将激活虚拟环境的命令加入supervisor command中

can't find command 'source'

==============================
在外部环境中安装flask,程序正常运行

启动控制台时出现错误:BACKOFF Exited too quickly (process log may have details).

对应错误日志

==============================
app.py源码

from flask import Flask
app=Flask(__name__)
@app.route('/')
def index():
return "Hello World"
if __name__=="__main__":
app.run(port=8080)

PHPzPHPz2803 days ago1338

reply all(4)I'll reply

  • PHP中文网

    PHP中文网2017-04-17 17:33:35

    Thank you everyone for your answers.
    It has been solved. You need to import the flask path in the virtual environment. Here is export PYTHONPATH=$PYTHONPATH:/root/FlaskWebDevelopment/venv/lib/python2.7/site-packages;
    This is the stackoverflow answer address: http:/ /stackoverflow.com/questions/24188...
    See link to first answer

    reply
    0
  • 高洛峰

    高洛峰2017-04-17 17:33:35

    You can configure the log of [program:app] first, and then determine from the log the specific reason why it failed to start successfully.
    The log configuration is as follows:

    [program:app]
    stdout_logfile=/path/app.log
    stderr_logfile=/path/app.log
    

    reply
    0
  • 怪我咯

    怪我咯2017-04-17 17:33:35

    Use an absolute path for source, and virtualenv is not active, causing the python environment that your command runs to not have flask installed.

    reply
    0
  • 伊谢尔伦

    伊谢尔伦2017-04-17 17:33:35

    Original, import flask failed, check if flask is installed
    pip install flask

    reply
    0
  • Cancelreply