【问题标题】:Creating upstart script on centos 6 for flask在centos 6上为flask创建新贵脚本
【发布时间】:2016-01-15 04:22:50
【问题描述】:

我正在尝试为我的烧瓶应用程序创建一个新贵脚本。我正在使用 uWSGI 来运行它。 我的应用程序位于 /home/user/apps/myapp。它包含 venv 中的虚拟环境。 我的目标是激活虚拟环境并在那里执行 ini 脚本

#description "Starts my app" 
#author "Me <myself@gmail.com>"

start on runlevel [2345]
stop on runlevel [!2345]



script
        cd /home/user/apps/myapp
        source venv/bin/activate
        exec uwsgi --ini myapp.ini
end script

当我在 /etc/init/ 中运行命令 sudo start myapp 时。我收到诸如进程以状态 127 终止之类的错误。这意味着我的命令是未知的。我是新贵脚本的新手。我在做什么错,这些脚本在 shell 中运行良好。

【问题讨论】:

    标签: python flask uwsgi centos6 upstart


    【解决方案1】:

    source 命令不是标准的 shell 命令。 Whatever Upstart is using internally doesn't use it. 请改用点运算符:. file

    然而,你不需要uwsgi之前的任何一个命令,工作目录和virtualenv都可以在uWSGI中配置。最好让uWSGI处理virtualenv,source activate只是为了开发方便。

    myapp.ini:

    [uwsgi]
    virtualenv = /path/to/env
    chdir = /path/to/project
    # other config here
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-09-06
      • 1970-01-01
      • 2012-01-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-01-20
      • 1970-01-01
      相关资源
      最近更新 更多