gpt4 book ai didi

python - Heroku 上的 Flask 有很多 500 错误,在开发机器上运行

转载 作者:行者123 更新时间:2023-11-28 19:26:19 35 4
gpt4 key购买 nike

我刚刚有一个关于在 Heroku 上运行 Flask 的快速问题。我不确定我做错了什么,但我很新,所以请原谅愚蠢的错误。

我正在使用 Flask 在 Heroku 上部署一个应用程序。为确保实现中的错误最少,代码直接取自 https://github.com/orf/simple .我在遵循此 https://devcenter.heroku.com/articles/python 时做了一些小调整.当我在开发机器上运行时程序运行良好(通过 python simple.py),程序在 heroku 上遇到一致的内部服务器错误。附上日志。

有什么想法吗?

2012-06-23T02:43:47+00:00 heroku[api]: Deploy 69a4995 by *********@gmail.com
2012-06-23T02:43:47+00:00 heroku[web.1]: State changed from up to bouncing
2012-06-23T02:43:47+00:00 heroku[web.1]: State changed from bouncing to created
2012-06-23T02:43:47+00:00 heroku[web.1]: State changed from created to starting
2012-06-23T02:43:47+00:00 heroku[slugc]: Slug compilation finished
2012-06-23T02:43:49+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2012-06-23T02:43:49+00:00 heroku[web.1]: Starting process with command `gunicorn simple:app -b 0.0.0.0:25399 -w 3`
2012-06-23T02:43:49+00:00 app[web.1]: 2012-06-23 02:43:49 [5] [INFO] Worker exiting (pid: 5)
2012-06-23T02:43:49+00:00 app[web.1]: 2012-06-23 02:43:49 [7] [INFO] Worker exiting (pid: 7)
2012-06-23T02:43:49+00:00 app[web.1]: 2012-06-23 02:43:49 [2] [INFO] Handling signal: term
2012-06-23T02:43:49+00:00 app[web.1]: 2012-06-23 02:43:49 [6] [INFO] Worker exiting (pid: 6)
2012-06-23T02:43:49+00:00 app[web.1]: 2012-06-23 02:43:49 [2] [INFO] Shutting down: Master
2012-06-23T02:43:50+00:00 app[web.1]: 2012-06-23 02:43:50 [2] [INFO] Starting gunicorn 0.13.4
2012-06-23T02:43:50+00:00 app[web.1]: 2012-06-23 02:43:50 [2] [INFO] Listening at: http://0.0.0.0:25399 (2)
2012-06-23T02:43:50+00:00 app[web.1]: 2012-06-23 02:43:50 [2] [INFO] Using worker: sync
2012-06-23T02:43:50+00:00 app[web.1]: 2012-06-23 02:43:50 [6] [INFO] Booting worker with pid: 6
2012-06-23T02:43:50+00:00 app[web.1]: 2012-06-23 02:43:50 [5] [INFO] Booting worker with pid: 5
2012-06-23T02:43:50+00:00 app[web.1]: 2012-06-23 02:43:50 [7] [INFO] Booting worker with pid: 7
2012-06-23T02:43:50+00:00 heroku[web.1]: Process exited with status 0
2012-06-23T02:43:51+00:00 heroku[web.1]: State changed from starting to up
2012-06-23T02:45:00+00:00 heroku[router]: GET deep-rain-4577.herokuapp.com/ dyno=web.1 queue=0 wait=0ms service=21ms status=500 bytes=291
2012-06-23T02:45:01+00:00 heroku[router]: GET deep-rain-4577.herokuapp.com/favicon.ico dyno=web.1 queue=0 wait=0ms service=14ms status=404 bytes=238
2012-06-23T02:45:01+00:00 heroku[router]: GET deep-rain-4577.herokuapp.com/ dyno=web.1 queue=0 wait=0ms service=3ms status=500 bytes=291
2012-06-23T02:45:01+00:00 heroku[router]: GET deep-rain-4577.herokuapp.com/favicon.ico dyno=web.1 queue=0 wait=0ms service=15ms status=404 bytes=238
2012-06-23T02:45:02+00:00 heroku[router]: GET deep-rain-4577.herokuapp.com/ dyno=web.1 queue=0 wait=0ms service=5ms status=500 bytes=291
2012-06-23T02:45:02+00:00 heroku[router]: GET deep-rain-4577.herokuapp.com/ dyno=web.1 queue=0 wait=0ms service=2ms status=500 bytes=291
2012-06-23T02:45:02+00:00 heroku[router]: GET deep-rain-4577.herokuapp.com/ dyno=web.1 queue=0 wait=0ms service=4ms status=500 bytes=291
2012-06-23T02:45:02+00:00 heroku[router]: GET deep-rain-4577.herokuapp.com/ dyno=web.1 queue=0 wait=0ms service=3ms status=500 bytes=291
2012-06-23T02:45:02+00:00 heroku[router]: GET deep-rain-4577.herokuapp.com/ dyno=web.1 queue=0 wait=0ms service=3ms status=500 bytes=291
2012-06-23T02:45:02+00:00 heroku[router]: GET deep-rain-4577.herokuapp.com/ dyno=web.1 queue=0 wait=0ms service=5ms status=500 bytes=291
2012-06-23T02:45:02+00:00 heroku[router]: GET deep-rain-4577.herokuapp.com/ dyno=web.1 queue=0 wait=0ms service=2ms status=500 bytes=291
2012-06-23T02:45:03+00:00 heroku[router]: GET deep-rain-4577.herokuapp.com/ dyno=web.1 queue=0 wait=0ms service=2ms status=500 bytes=291
2012-06-23T02:45:03+00:00 heroku[router]: GET deep-rain-4577.herokuapp.com/ dyno=web.1 queue=0 wait=0ms service=4ms status=500 bytes=291
2012-06-23T02:45:03+00:00 heroku[router]: GET deep-rain-4577.herokuapp.com/ dyno=web.1 queue=0 wait=0ms service=4ms status=500 bytes=291
2012-06-23T02:45:03+00:00 heroku[router]: GET deep-rain-4577.herokuapp.com/favicon.ico dyno=web.1 queue=0 wait=0ms service=2ms status=404 bytes=238
2012-06-23T02:45:32+00:00 heroku[router]: GET deep-rain-4577.herokuapp.com/ dyno=web.1 queue=0 wait=0ms service=2ms status=500 bytes=291
2012-06-23T02:45:32+00:00 heroku[router]: GET deep-rain-4577.herokuapp.com/favicon.ico dyno=web.1 queue=0 wait=0ms service=13ms status=404 bytes=238

最佳答案

编辑:您的应用程序在本地运行吗?您的 Procfile 是什么样的?

此外,似乎 Heroku 在处理线程时表现得很古怪。看起来您的应用在几秒钟后收到了 SIGTERM。我会输入一些打印语句来确定应用程序在终止前所做的最后几件事。

这是您的第一个 Flask 应用程序吗?你的最终目标是什么?学习?如果是这样,我不会从这个开始。尝试从头开始编写您的第一个应用程序,以便了解每一行的作用。我将从 Flask 教程开始:

http://flask.pocoo.org/docs/

然后可以查看以下有关在 Heroku 上部署 Flask 应用程序的教程:

http://ryaneshea.com/lightweight-python-apps-with-flask-twitter-bootstrap-and-heroku

关于python - Heroku 上的 Flask 有很多 500 错误,在开发机器上运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11166486/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com