在heroku上部署django网站时出错

时间:2015-02-26 10:11:23

标签: django heroku heroku-postgres

我正在django的setting.py文件中使用DATABASE = {}在heroku中部署我的django网站。 我正在执行heroku help的所有步骤,并且每个命令都运行了  但是一些应用程序错误正在运行命令 -

heroku open

 (jango)dc@dc-comp-4:~/website$ heroku open
    Opening evening-waters-7886... done
    (jango)dc@dc-comp-4:~/website$ 
    (process:8176): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed

和我的heroku日志状态是 -

dc@dc-comp-4:~/website$ heroku logs
2015-02-26T09:07:09.555685+00:00 heroku[web.1]: State changed from crashed to starting
2015-02-26T09:07:09.555087+00:00 heroku[web.1]: State changed from starting to crashed
2015-02-26T09:07:17.890143+00:00 heroku[web.1]: Starting process with command `gunicorn gettingstarted.wsgi --log-file -`
2015-02-26T09:07:20.325197+00:00 app[web.1]: bash: gunicorn: command not found
2015-02-26T09:07:21.184736+00:00 heroku[web.1]: Process exited with status 127
2015-02-26T09:07:21.202490+00:00 heroku[web.1]: State changed from starting to crashed
2015-02-26T09:07:27.250898+00:00 heroku[api]: Scale to web=1 by rahulsatal92@gmail.com
2015-02-26T09:07:56.156898+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=evening-waters-7886.herokuapp.com request_id=9a9781c5-57d6-43c2-8ca0-43df571804a0 fwd="14.139.240.226" dyno= connect= service= status=503 bytes=
2015-02-26T09:08:01.602067+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=evening-waters-7886.herokuapp.com request_id=597a1c36-200e-4f8c-8dfe-b00d4d2cacee fwd="14.139.240.226" dyno= connect= service= status=503 bytes=
2015-02-26T09:08:03.737046+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=evening-waters-7886.herokuapp.com request_id=4d790108-6019-4fce-9d1e-10eafca9efc1 fwd="14.139.240.226" dyno= connect= service= status=503 bytes=
2015-02-26T09:27:54.099907+00:00 heroku[api]: Deploy e061461 by rahulsatal92@gmail.com
2015-02-26T09:27:54.099907+00:00 heroku[api]: Release v6 created by rahulsatal92@gmail.com
2015-02-26T09:27:54.255144+00:00 heroku[web.1]: State changed from crashed to starting
2015-02-26T09:28:05.720678+00:00 heroku[web.1]: Starting process with command `gunicorn website:app --log-file=-`
2015-02-26T09:28:06.984648+00:00 app[web.1]: bash: gunicorn: command not found
2015-02-26T09:28:07.736542+00:00 heroku[web.1]: State changed from starting to crashed
2015-02-26T09:28:07.737796+00:00 heroku[web.1]: State changed from crashed to starting
2015-02-26T09:28:07.721050+00:00 heroku[web.1]: Process exited with status 127
2015-02-26T09:28:11.784672+00:00 heroku[web.1]: Starting process with command `gunicorn website:app --log-file=-`
2015-02-26T09:28:13.765503+00:00 app[web.1]: bash: gunicorn: command not found
2015-02-26T09:28:14.689070+00:00 heroku[web.1]: Process exited with status 127
2015-02-26T09:28:14.702968+00:00 heroku[web.1]: State changed from starting to crashed
2015-02-26T09:28:18.234685+00:00 heroku[api]: Scale to web=1 by rahulsatal92@gmail.com
2015-02-26T09:28:48.532426+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=evening-waters-7886.herokuapp.com request_id=a2b76940-91ea-4d2d-884e-0049bc707217 fwd="14.139.240.226" dyno= connect= service= status=503 bytes=
2015-02-26T09:32:01.295019+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=evening-waters-7886.herokuapp.com request_id=7bf7ddc0-a04f-4f40-aade-f7a5116cf9f0 fwd="14.139.240.226" dyno= connect= service= status=503 bytes=
2015-02-26T09:34:29.437580+00:00 heroku[api]: Attach HEROKU_POSTGRESQL_BLUE resource by rahulsatal92@gmail.com
2015-02-26T09:34:29.437580+00:00 heroku[api]: Release v7 created by rahulsatal92@gmail.com
2015-02-26T09:34:29.678932+00:00 heroku[web.1]: State changed from crashed to starting
2015-02-26T09:34:33.288768+00:00 heroku[web.1]: Starting process with command `gunicorn website:app --log-file=-`
2015-02-26T09:34:35.045626+00:00 app[web.1]: bash: gunicorn: command not found
2015-02-26T09:34:35.717937+00:00 heroku[web.1]: Process exited with status 127
2015-02-26T09:34:35.729414+00:00 heroku[web.1]: State changed from starting to crashed
2015-02-26T09:39:47.384245+00:00 heroku[api]: Release v8 created by rahulsatal92@gmail.com
2015-02-26T09:39:47.384245+00:00 heroku[api]: Attach HEROKU_POSTGRESQL_OLIVE resource by rahulsatal92@gmail.com
2015-02-26T09:39:47.747151+00:00 heroku[web.1]: State changed from crashed to starting
2015-02-26T09:39:50.940581+00:00 heroku[web.1]: Starting process with command `gunicorn website:app --log-file=-`
2015-02-26T09:39:52.075160+00:00 app[web.1]: bash: gunicorn: command not found
2015-02-26T09:39:52.716034+00:00 heroku[web.1]: State changed from starting to crashed
2015-02-26T09:39:52.716772+00:00 heroku[web.1]: State changed from crashed to starting
2015-02-26T09:39:52.705237+00:00 heroku[web.1]: Process exited with status 127
2015-02-26T09:39:56.910325+00:00 heroku[web.1]: Starting process with command `gunicorn website:app --log-file=-`
2015-02-26T09:39:58.335235+00:00 app[web.1]: bash: gunicorn: command not found
2015-02-26T09:39:59.091134+00:00 heroku[web.1]: Process exited with status 127
2015-02-26T09:39:59.123230+00:00 heroku[web.1]: State changed from starting to crashed
2015-02-26T09:41:28.032235+00:00 heroku[api]: Deploy 5e882c5 by rahulsatal92@gmail.com
2015-02-26T09:41:28.032235+00:00 heroku[api]: Release v9 created by rahulsatal92@gmail.com
2015-02-26T09:41:28.577676+00:00 heroku[web.1]: State changed from crashed to starting
2015-02-26T09:41:32.256825+00:00 heroku[web.1]: Starting process with command `gunicorn website:app --log-file=-`
2015-02-26T09:41:33.437334+00:00 app[web.1]: bash: gunicorn: command not found
2015-02-26T09:41:34.121450+00:00 heroku[web.1]: Process exited with status 127
2015-02-26T09:41:34.126557+00:00 heroku[web.1]: State changed from starting to crashed
2015-02-26T09:41:46.438295+00:00 heroku[api]: Scale to web=1 by rahulsatal92@gmail.com
2015-02-26T09:42:04.929728+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=evening-waters-7886.herokuapp.com request_id=f16cebee-7c15-42d5-bba6-a4c85d0addaf fwd="14.139.240.226" dyno= connect= service= status=503 bytes=
2015-02-26T09:43:05.406941+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=evening-waters-7886.herokuapp.com request_id=9e4aa61d-073d-49d2-a696-606b4c965d51 fwd="14.139.240.226" dyno= connect= service= status=503 bytes=
2015-02-26T09:44:05.946147+00:00 heroku[api]: Attach HEROKU_POSTGRESQL_COPPER resource by rahulsatal92@gmail.com
2015-02-26T09:44:05.946147+00:00 heroku[api]: Release v10 created by rahulsatal92@gmail.com
2015-02-26T09:44:06.133499+00:00 heroku[web.1]: State changed from crashed to starting
2015-02-26T09:44:09.806610+00:00 heroku[web.1]: Starting process with command `gunicorn website:app --log-file=-`
2015-02-26T09:44:11.203036+00:00 app[web.1]: bash: gunicorn: command not found
2015-02-26T09:44:11.895235+00:00 heroku[web.1]: Process exited with status 127
2015-02-26T09:44:11.911573+00:00 heroku[web.1]: State changed from starting to crashed
2015-02-26T09:52:08.400443+00:00 heroku[api]: Scale to web=1 by rahulsatal92@gmail.com
2015-02-26T09:52:30.139203+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=evening-waters-7886.herokuapp.com request_id=2e818d74-a717-41d4-9050-3be25889eaed fwd="14.139.240.226" dyno= connect= service= status=503 bytes=
2015-02-26T09:58:07.383685+00:00 heroku[api]: Starting process with command `rake db:migrate` by rahulsatal92@gmail.com
2015-02-26T09:58:11.492711+00:00 heroku[run.3731]: Awaiting client
2015-02-26T09:58:11.520152+00:00 heroku[run.3731]: Starting process with command `rake db:migrate`
2015-02-26T09:58:13.489900+00:00 heroku[run.3731]: Process exited with status 127
2015-02-26T09:58:13.503789+00:00 heroku[run.3731]: State changed from up to complete
2015-02-26T09:58:11.931301+00:00 heroku[run.3731]: State changed from starting to up
2015-02-26T09:59:05.424832+00:00 heroku[web.1]: State changed from crashed to starting
2015-02-26T09:59:12.340999+00:00 heroku[web.1]: Starting process with command `gunicorn website:app --log-file=-`
2015-02-26T09:59:13.778095+00:00 app[web.1]: bash: gunicorn: command not found
2015-02-26T09:59:14.428734+00:00 heroku[web.1]: Process exited with status 127
2015-02-26T09:59:14.437924+00:00 heroku[web.1]: State changed from starting to crashed
2015-02-26T09:59:14.438617+00:00 heroku[web.1]: State changed from crashed to starting
2015-02-26T09:59:17.805847+00:00 heroku[web.1]: Starting process with command `gunicorn website:app --log-file=-`
2015-02-26T09:59:19.331755+00:00 app[web.1]: bash: gunicorn: command not found
2015-02-26T09:59:20.010738+00:00 heroku[web.1]: Process exited with status 127
2015-02-26T09:59:20.028996+00:00 heroku[web.1]: State changed from starting to crashed
2015-02-26T09:59:23.726010+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=evening-waters-7886.herokuapp.com request_id=c2ba4a6d-1357-47a4-abee-78cfe3db7545 fwd="14.139.240.226" dyno= connect= service= status=503 bytes=
2015-02-26T10:04:06.912448+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=evening-waters-7886.herokuapp.com request_id=5d21087f-d811-4685-964b-23acf24fd499 fwd="14.139.240.226" dyno= connect= service= status=503 bytes=
2015-02-26T10:29:10.000446+00:00 heroku[api]: Starting process with command `pip install gunicorn` by rahulsatal92@gmail.com
2015-02-26T10:29:13.833066+00:00 heroku[run.8299]: Awaiting client
2015-02-26T10:29:13.871544+00:00 heroku[run.8299]: Starting process with command `pip install gunicorn`
2015-02-26T10:29:14.121060+00:00 heroku[run.8299]: State changed from starting to up
2015-02-26T10:29:18.182526+00:00 heroku[run.8299]: Process exited with status 0
2015-02-26T10:29:18.195891+00:00 heroku[run.8299]: State changed from up to complete
2015-02-26T10:32:34.286827+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=evening-waters-7886.herokuapp.com request_id=29508561-6c27-4ac6-a67d-7543fb87b385 fwd="14.139.240.226" dyno= connect= service= status=503 bytes=
2015-02-26T10:36:58.977614+00:00 heroku[web.1]: State changed from crashed to starting
2015-02-26T10:37:02.450833+00:00 heroku[web.1]: Starting process with command `gunicorn website:app --log-file=-`
2015-02-26T10:37:03.717531+00:00 app[web.1]: bash: gunicorn: command not found
2015-02-26T10:37:04.438957+00:00 heroku[web.1]: State changed from starting to crashed
2015-02-26T10:37:04.439393+00:00 heroku[web.1]: State changed from crashed to starting
2015-02-26T10:37:04.418361+00:00 heroku[web.1]: Process exited with status 127
2015-02-26T10:37:08.015347+00:00 heroku[web.1]: Starting process with command `gunicorn website:app --log-file=-`
2015-02-26T10:37:09.728762+00:00 app[web.1]: bash: gunicorn: command not found
2015-02-26T10:37:10.601803+00:00 heroku[web.1]: State changed from starting to crashed
2015-02-26T10:37:10.596391+00:00 heroku[web.1]: Process exited with status 127
2015-02-26T11:21:32.653989+00:00 heroku[web.1]: State changed from crashed to starting
2015-02-26T11:21:36.340593+00:00 heroku[web.1]: Starting process with command `gunicorn website:app --log-file=-`
2015-02-26T11:23:39.380466+00:00 heroku[web.1]: State changed from starting to down
dc@dc-comp-4:~/website$ ^C

请帮助我。

2 个答案:

答案 0 :(得分:2)

  

bash:gunicorn:命令未找到

上述错误明确提到您在Heroku服务器上没有gunicorn

如何安装

  1. 使用pip install gunicorn安装它将清除错误。
  2. 将gunicorn添加到您的requirements.txt文件

答案 1 :(得分:1)

您应该安装django-toolbelt(您可以通过pip install django-toolbelt执行此操作)并安装gunicorn)之后您需要将其添加到您的requirements.txt(使用pip freeze > requirements.txt)。

让我这样解释一下。 Heroku查看您的文件结构并搜索两件事: 一个Procfile和一个requirements.txt(如果你有一个python项目,如果你有其他项目,这个文件的名称代表你项目的依赖项可能有另一个名字,但让我们坚持使用python django)。 / p>

它使用requirements.txt的内容来查看它需要安装的内容,如果我想要一个特定的库需要在那个requirements.txt(heroku将安装它知道它应该安装的所有内容,它知道什么它应该通过查看requirements.txt安装

然后它查看Procfile(此文件告诉它应该运行什么以启动项目)

现在来看你的bug,你可以在那个prof文件中写下流动的东西 web: python manage.py runserver 0.0.0.0:$PORT

这意味着:启动web dyno,运行以下命令并使用环境变量$PORT提供的端口 这将启动django,就像在本地主机上一样,使用测试服务器,只是为了确保它有效。你不应该在生产中使用它,但调试是好的。

如果你无法使用它,那就意味着你还有其他问题,而不仅仅是枪炮失踪。

在heroku教程中有一部分说:

  

接下来,使用pip安装我们的应用程序的依赖项。在这种情况下,我们将安装django-toolbelt,其中包含我们需要的所有软件包:   Django(网络框架)   Gunicorn(WSGI服务器)   dj-database-url(一个Django配置助手)   dj-static(一个Django静态文件服务器)

将您的requirements.txt粘贴到此处,以便我们更快地了解它。

在heroku上使用Django时使用this