【问题标题】:Unable to start gunicorn(Django Node app) on heroku Error : Connection in use: ('0.0.0.0', 46831)无法在 heroku 上启动 gunicorn(Django 节点应用程序)错误:使用中的连接:('0.0.0.0',46831)
【发布时间】:2016-06-11 16:27:22
【问题描述】:

我正在尝试在 heroku 上托管一个 Django Node 应用程序。我的 procfile 看起来像这样

web: gunicorn backend courier.wsgi:application --bind 0.0.0.0:$PORT & node frontend/server.js

我的 server.js 运行 index.html。我正在显示 index.html 页面。但是 Django 网址不起作用。

我的 heroku 日志显示了这一点。

    2016-02-28T17:25:40.032724+00:00 app[web.1]: [2016-02-28 17:25:40 +0000] [7] [INFO] Starting gunicorn 19.3.0
    2016-02-28T17:25:40.258117+00:00 heroku[web.1]: State changed from starting to up
    2016-02-28T17:25:41.042335+00:00 app[web.1]: [2016-02-28 17:25:41 +0000] [7] [ERROR] Connection in use: ('0.0.0.0', 46831)
    2016-02-28T17:25:41.042419+00:00 app[web.1]: [2016-02-28 17:25:41 +0000] [7] [ERROR] Retrying in 1 second.

而且我的 gunicorni 没有启动。

但是,当我从我的 procfile 中删除 & node frontend/server.js 时,它会正常运行 django 应用程序并且我所有的 Django URL 都可以正常工作。

如果有人能告诉我这里出了什么问题,那就太好了。提前致谢。

【问题讨论】:

  • 看来你在同一个端口上启动node和django。
  • 我认为我无法控制 heroku 上的端口号。知道怎么做吗?
  • 检查that
  • 为什么要同时运行 Django 和 Node?​​span>
  • @Daniel Roseman 我在前端使用节点,在后端使用 Django

标签: django node.js heroku django-urls gunicorn


【解决方案1】:

我认为你不能在一个 heroku dyno 上为两个不同的进程提供两个端口。

您可能必须使用另一个测功机来运行另一个。

我还建议将前端页面作为静态文件并通过 Django 提供服务。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-04-27
    • 2019-01-12
    • 2015-02-14
    • 1970-01-01
    • 1970-01-01
    • 2013-05-21
    • 2016-04-09
    • 1970-01-01
    相关资源
    最近更新 更多