【问题标题】:Gunicorn doesn't work独角兽不工作
【发布时间】:2014-08-19 06:11:42
【问题描述】:

我正在尝试在 heroku 上部署我的 django 应用程序。按照官方文档的步骤进行操作后,我启动的dyno总是崩溃。然后我经历了整个过程,我认为问题可能出在gunicorn部分。 按照说明,我将 Procfile 设置为“web: unicorn hellodjango.wsgi”,当我启动 $foreman 时,它只显示“21:21:07 web.1 | 以 pid 77969 开始”。它没有说明网络是在哪里启动的。 然后我尝试测试 gunicorn 是否运行良好。所以我尝试了:“$gunicorn hellodjango.wsgi:application”,它确实不起作用。

我认为路径是正确的,因为在当前文件夹中有一个 hellodjango 文件夹,里面有文件 wsgi.py。

可能是什么问题?

【问题讨论】:

    标签: python django heroku virtualenv gunicorn


    【解决方案1】:

    gunicorn 的更高版本中的一个更改包括不记录到 stdout/stderr。添加参数 --log-file=XXX,然后检查该日志文件的运行端口。

    【讨论】:

      【解决方案2】:

      尝试将您的 Procfile 设置为:

      web: gunicorn hellodjango.wsgi:application
      

      【讨论】:

        【解决方案3】:

        在你的 Procfile 中写下这个:

        web: gunicorn hellodjango.wsgi --log-file -
        

        它会将所有内容记录到屏幕上,如下所示:

        (your_virtualenv)[~/Projects/myproj]$ foreman start
        17:03:57 web.1  | started with pid 79137
        17:03:58 web.1  | 2014-10-16 17:03:58 [79137] [INFO] Starting gunicorn 19.0.0
        17:03:58 web.1  | 2014-10-16 17:03:58 [79137] [INFO] Listening at: http://0.0.0.0:5000 (79137)
        17:03:58 web.1  | 2014-10-16 17:03:58 [79137] [INFO] Using worker: sync
        17:03:58 web.1  | 2014-10-16 17:03:58 [79140] [INFO] Booting worker with pid: 79140
        

        【讨论】:

          猜你喜欢
          • 2015-12-01
          • 1970-01-01
          • 2014-08-04
          • 1970-01-01
          • 1970-01-01
          • 2012-06-18
          • 2011-08-29
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多