【问题标题】:Django deployed project not running subprocess shell commandDjango部署的项目没有运行子进程shell命令
【发布时间】:2016-06-02 03:08:40
【问题描述】:

我有一个使用 gunicorn 部署的 django 1.9 项目,其中视图包含一行

subprocess.call(["xvfb-run ./stored/all_crawlers.sh "+outputfile+" " + url], shell=True, cwd= path_to_sh_file)

使用 ./manage.py runserver 运行良好 但部署失败并且(使用 gunicorn 和 wsgi 部署)。

任何建议如何解决它?

【问题讨论】:

  • 你确定用户权限没问题?
  • 可能是权限问题。 Manage.py 使用您自己的用户运行,使用 www-data 进行部署

标签: python django shell subprocess gunicorn


【解决方案1】:

1) 运行gunicorn的用户没有运行.sh文件的权限

2) 您的 .sh 文件无权运行

3) 尝试使用文件的完整路径

另外,当您尝试在生产环境中运行它时会遇到哪个错误?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-05-16
    • 2020-12-30
    • 2012-05-28
    • 1970-01-01
    • 1970-01-01
    • 2016-09-23
    • 2011-03-03
    • 1970-01-01
    相关资源
    最近更新 更多