繁体   English   中英

Heroku 上的 Django 应用程序:应用程序错误

[英]Django app on Heroku: Application Error

尝试在 Heroku 上启动 Django Web 应用程序。

获取应用程序错误:应用程序发生错误,无法提供您的页面。 请稍后重试。 如果您是应用程序所有者,请检查您的日志以了解详细信息。

heroku日志:

2014-02-28T01:49:58.706311+00:00 heroku[run.6585]: Starting process with command `rake`
2014-02-28T01:50:01.064056+00:00 heroku[run.6585]: Process exited with status 1
2014-02-28T01:50:01.078817+00:00 heroku[run.6585]: State changed from up to complete
2014-02-28T01:47:36.064095+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=whispering-waters-3343.herokuapp.com request_id=8dd34dc2-41ee-40ef-b603-e731ba8a6078 fwd="173.164.141.93" dyno= connect= service= status=503 bytes=
2014-02-28T01:49:52.192771+00:00 heroku[api]: Starting process with command `rake` by amy.r.lam@gmail.com
2014-02-28T01:51:19.326151+00:00 heroku[run.7560]: Awaiting client
2014-02-28T01:51:19.358198+00:00 heroku[run.7560]: State changed from starting to up
2014-02-28T01:51:19.362731+00:00 heroku[run.7560]: Starting process with command `python manage.py syncdb`
2014-02-28T01:51:21.075401+00:00 heroku[run.7560]: State changed from up to complete
2014-02-28T01:51:21.062102+00:00 heroku[run.7560]: Process exited with status 2
2014-02-28T01:51:30.442655+00:00 heroku[api]: Starting process with command `python mysite/manage.py syncdb` by amy.r.lam@gmail.com
2014-02-28T01:51:36.973260+00:00 heroku[run.9486]: Awaiting client
2014-02-28T01:51:37.100935+00:00 heroku[run.9486]: Starting process with command `python mysite/manage.py syncdb`
2014-02-28T01:52:01.887843+00:00 heroku[run.9486]: Process exited with status 0
2014-02-28T01:49:46.430021+00:00 heroku[run.4760]: State changed from up to complete
2014-02-28T01:52:11.589525+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=whispering-waters-3343.herokuapp.com request_id=8cd012cf-37cd-424e-8e69-c8463d488d95 fwd="173.164.141.93" dyno= connect= service= status=503 bytes=
2014-02-28T01:52:12.020302+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=whispering-waters-3343.herokuapp.com request_id=fe3d19e2-af38-46b6-a9f2-2f3e76bd4bff fwd="173.164.141.93" dyno= connect= service= status=503 bytes=
2014-02-28T01:52:01.902293+00:00 heroku[run.9486]: State changed from up to complete
2014-02-28T01:55:19.056405+00:00 heroku[web.1]: Starting process with command `gunicorn hellodjango.wsgi`
2014-02-28T01:55:20.491536+00:00 app[web.1]: 2014-02-28 01:55:20 [2] [INFO] Listening at: http://0.0.0.0:45860 (2)
2014-02-28T01:55:20.490915+00:00 app[web.1]: 2014-02-28 01:55:20 [2] [INFO] Starting gunicorn 18.0
2014-02-28T01:55:20.502381+00:00 app[web.1]: 2014-02-28 01:55:20 [2] [INFO] Using worker: sync
2014-02-28T01:55:20.520439+00:00 app[web.1]: 2014-02-28 01:55:20 [7] [INFO] Booting worker with pid: 7
2014-02-28T01:55:20.532572+00:00 app[web.1]: 2014-02-28 01:55:20 [7] [ERROR] Exception in worker process:
2014-02-28T01:55:20.532572+00:00 app[web.1]: Traceback (most recent call last):
2014-02-28T01:55:20.532572+00:00 app[web.1]:     self.wsgi = self.app.wsgi()
2014-02-28T01:55:20.532572+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 495, in spawn_worker
2014-02-28T01:55:20.532812+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 49, in load_wsgiapp
2014-02-28T01:55:20.532812+00:00 app[web.1]:     return util.import_app(self.app_uri)
2014-02-28T01:55:20.532812+00:00 app[web.1]:     __import__(module)
2014-02-28T01:55:20.532572+00:00 app[web.1]:     worker.init_process()
2014-02-28T01:55:20.532572+00:00 app[web.1]:     self.callable = self.load()
2014-02-28T01:55:20.532572+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 106, in init_process
2014-02-28T01:55:20.532572+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 62, in load
2014-02-28T01:55:20.532812+00:00 app[web.1]:     self.wsgi = self.app.wsgi()
2014-02-28T01:55:20.532812+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 106, in init_process
2014-02-28T01:55:20.532812+00:00 app[web.1]: Traceback (most recent call last):
2014-02-28T01:55:20.533000+00:00 app[web.1]:     self.callable = self.load()
2014-02-28T01:55:20.532572+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 114, in wsgi
2014-02-28T01:55:20.532572+00:00 app[web.1]:     return self.load_wsgiapp()
2014-02-28T01:55:20.532812+00:00 app[web.1]: ImportError: No module named hellodjango.wsgi
2014-02-28T01:55:20.532812+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/util.py", line 354, in import_app
2014-02-28T01:55:20.532812+00:00 app[web.1]:     worker.init_process()
2014-02-28T01:55:20.533000+00:00 app[web.1]:     __import__(module)
2014-02-28T01:55:20.533000+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 62, in load
2014-02-28T01:55:20.533000+00:00 app[web.1]: 2014-02-28 01:55:20 [7] [INFO] Worker exiting (pid: 7)
2014-02-28T01:55:20.533000+00:00 app[web.1]:     return self.load_wsgiapp()
2014-02-28T01:55:20.533000+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 49, in load_wsgiapp
2014-02-28T01:55:20.533000+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 114, in wsgi
2014-02-28T01:55:20.533000+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/util.py", line 354, in import_app
2014-02-28T01:55:20.532812+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 495, in spawn_worker
2014-02-28T01:55:20.533000+00:00 app[web.1]: ImportError: No module named hellodjango.wsgi
2014-02-28T01:55:20.533000+00:00 app[web.1]:     return util.import_app(self.app_uri)
2014-02-28T01:55:20.689228+00:00 app[web.1]: 2014-02-28 01:55:20 [2] [INFO] Shutting down: Master
2014-02-28T01:55:20.689360+00:00 app[web.1]: 2014-02-28 01:55:20 [2] [INFO] Reason: Worker failed to boot.
2014-02-28T01:55:21.970445+00:00 heroku[web.1]: Process exited with status 3
2014-02-28T01:55:27.158974+00:00 heroku[web.1]: Starting process with command `gunicorn hellodjango.wsgi`
2014-02-28T01:55:28.155161+00:00 app[web.1]: 2014-02-28 01:55:28 [2] [INFO] Starting gunicorn 18.0
2014-02-28T01:55:28.156682+00:00 app[web.1]: 2014-02-28 01:55:28 [2] [INFO] Listening at: http://0.0.0.0:8671 (2)
2014-02-28T01:55:28.156682+00:00 app[web.1]: 2014-02-28 01:55:28 [2] [INFO] Using worker: sync
2014-02-28T01:55:28.166192+00:00 app[web.1]: 2014-02-28 01:55:28 [7] [INFO] Booting worker with pid: 7
2014-02-28T01:55:28.171442+00:00 app[web.1]: 2014-02-28 01:55:28 [7] [ERROR] Exception in worker process:
2014-02-28T01:55:28.171442+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 114, in wsgi
2014-02-28T01:55:28.171442+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 62, in load
2014-02-28T01:55:28.171442+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 495, in spawn_worker
2014-02-28T01:55:28.171442+00:00 app[web.1]: Traceback (most recent call last):
2014-02-28T01:55:28.171442+00:00 app[web.1]:     worker.init_process()
2014-02-28T01:55:28.171442+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 106, in init_process
2014-02-28T01:55:28.171442+00:00 app[web.1]:     self.wsgi = self.app.wsgi()
2014-02-28T01:55:28.171442+00:00 app[web.1]:     return self.load_wsgiapp()
2014-02-28T01:55:28.171688+00:00 app[web.1]: Traceback (most recent call last):
2014-02-28T01:55:28.171688+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 49, in load_wsgiapp
2014-02-28T01:55:28.171688+00:00 app[web.1]:     return util.import_app(self.app_uri)
2014-02-28T01:55:28.171442+00:00 app[web.1]:     self.callable = self.load()
2014-02-28T01:55:28.171688+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/util.py", line 354, in import_app
2014-02-28T01:55:28.171688+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 106, in init_process
2014-02-28T01:55:28.171876+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 49, in load_wsgiapp
2014-02-28T01:55:28.171688+00:00 app[web.1]:     self.wsgi = self.app.wsgi()
2014-02-28T01:55:28.171688+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 495, in spawn_worker
2014-02-28T01:55:28.171876+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 114, in wsgi
2014-02-28T01:55:28.171876+00:00 app[web.1]:     self.callable = self.load()
2014-02-28T01:55:28.171688+00:00 app[web.1]:     __import__(module)
2014-02-28T01:55:28.171876+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 62, in load
2014-02-28T01:55:28.171688+00:00 app[web.1]:     worker.init_process()
2014-02-28T01:55:28.171876+00:00 app[web.1]:     __import__(module)
2014-02-28T01:55:28.171876+00:00 app[web.1]: ImportError: No module named hellodjango.wsgi
2014-02-28T01:55:28.171876+00:00 app[web.1]: 2014-02-28 01:55:28 [7] [INFO] Worker exiting (pid: 7)
2014-02-28T01:55:28.171876+00:00 app[web.1]:     return self.load_wsgiapp()
2014-02-28T01:55:28.171876+00:00 app[web.1]:     return util.import_app(self.app_uri)
2014-02-28T01:55:28.171688+00:00 app[web.1]: ImportError: No module named hellodjango.wsgi
2014-02-28T01:55:28.171876+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/util.py", line 354, in import_app
2014-02-28T01:55:28.302686+00:00 app[web.1]: 2014-02-28 01:55:28 [2] [INFO] Reason: Worker failed to boot.
2014-02-28T01:55:28.301829+00:00 app[web.1]: 2014-02-28 01:55:28 [2] [INFO] Shutting down: Master
2014-02-28T01:55:29.730749+00:00 heroku[web.1]: Process exited with status 3
2014-02-28T01:56:03.044535+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=whispering-waters-3343.herokuapp.com request_id=1f164238-99f1-4ba8-8761-7269025f0322 fwd="173.164.141.93" dyno= connect= service= status=503 bytes=
2014-02-28T01:55:14.121881+00:00 heroku[web.1]: State changed from crashed to starting
2014-02-28T01:55:21.980705+00:00 heroku[web.1]: State changed from starting to crashed
2014-02-28T01:55:21.981905+00:00 heroku[web.1]: State changed from crashed to starting
2014-02-28T01:55:29.742422+00:00 heroku[web.1]: State changed from starting to crashed
2014-02-28T01:59:40.421794+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=whispering-waters-3343.herokuapp.com request_id=349cce4c-69af-42ee-a19d-5c35d6713390 fwd="173.164.141.93" dyno= connect= service= status=503 bytes=
2014-02-28T01:59:40.682076+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=whispering-waters-3343.herokuapp.com request_id=f998d494-1026-45b3-9c44-2cfb19f45b14 fwd="173.164.141.93" dyno= connect= service= status=503 bytes=

问题似乎是这样的:“ImportError: No module named hellodjango.wsgi”

根据您发布的信息,听起来“hellodjango”不是您的项目和 WSGI 应用程序的名称,因此对 hellodjango.wsgi 的引用失败。

我猜你的项目结构和 wsgi.py 文件中的名称应该是“mysite”。

编辑:您的 procfile 应该调用 .wsgi (这是默认的 django 行为)。

请在评论中最重要的是你用来启动这个项目的项目名称是什么。

更新 procfile,将 mysite.wsgi 替换为您的应用程序的正确名称,它将运行。

您可能是通过教程来到这里的,更改此信息并不明显。

对于我的情况,在 Procfile 中,我将核心文件夹的名称命名为 .wsgi,因此我将其命名为“hellodjango.wsgi”,但随后在 mysite 文件夹中,我在 .wsgi 文件中看到该名称必须是 mysite.wsgi。 所以我回到 Procfile 并将 hellodjango.wsgi 重命名为 mysite.wsgi,然后 Heroku App 完美运行。

检查您在 procfile 中设置的名称

网络:gunicorn“名称”.wsgi --log-file -

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM