4

我正在尝试在 Heroku 上部署 Tornado。我可以使用这种方法运行一个简单的“hello world”应用程序:http: //kzk9.net/deploying-tornado-on-heroku-mac-os-x

但是在尝试 Tornado 演示应用程序“chatdemo”时,服务器崩溃并显示以下日志:

11:22:45 web.1  | 2012-11-12 11:22:45 [18442] [ERROR] Exception in worker process:
11:22:45 web.1  | Traceback (most recent call last):
11:22:45 web.1  |   File "/Users/princekumar/Downloads/tornado-2.4/demos/ChatOnHeroku/lib/python2.7/site-packages/gunicorn/arbiter.py", line 461, in spawn_worker
11:22:45 web.1  |     worker.init_process()
11:22:45 web.1  |   File "/Users/princekumar/Downloads/tornado-2.4/demos/ChatOnHeroku/lib/python2.7/site-packages/gunicorn/workers/base.py", line 101, in init_process
11:22:45 web.1  |     self.wsgi = self.app.wsgi()
11:22:45 web.1  |   File "/Users/princekumar/Downloads/tornado-2.4/demos/ChatOnHeroku/lib/python2.7/site-packages/gunicorn/app/base.py", line 101, in wsgi
11:22:45 web.1  |     self.callable = self.load()
11:22:45 web.1  |   File "/Users/princekumar/Downloads/tornado-2.4/demos/ChatOnHeroku/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 24, in load
11:22:45 web.1  |     return util.import_app(self.app_uri)
11:22:45 web.1  |   File "/Users/princekumar/Downloads/tornado-2.4/demos/ChatOnHeroku/lib/python2.7/site-packages/gunicorn/util.py", line 292, in import_app
11:22:45 web.1  |     app = eval(obj, mod.__dict__)
11:22:45 web.1  |   File "<string>", line 1, in <module>
11:22:45 web.1  | NameError: name 'application' is not defined
11:22:45 web.1  | Traceback (most recent call last):
11:22:45 web.1  |   File "/Users/princekumar/Downloads/tornado-2.4/demos/ChatOnHeroku/lib/python2.7/site-packages/gunicorn/arbiter.py", line 461, in spawn_worker
11:22:45 web.1  |     worker.init_process()
11:22:45 web.1  |   File "/Users/princekumar/Downloads/tornado-2.4/demos/ChatOnHeroku/lib/python2.7/site-packages/gunicorn/workers/base.py", line 101, in init_process
11:22:45 web.1  |     self.wsgi = self.app.wsgi()
11:22:45 web.1  |   File "/Users/princekumar/Downloads/tornado-2.4/demos/ChatOnHeroku/lib/python2.7/site-packages/gunicorn/app/base.py", line 101, in wsgi
11:22:45 web.1  |     self.callable = self.load()
11:22:45 web.1  |   File "/Users/princekumar/Downloads/tornado-2.4/demos/ChatOnHeroku/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 24, in load
11:22:45 web.1  |     return util.import_app(self.app_uri)
11:22:45 web.1  |   File "/Users/princekumar/Downloads/tornado-2.4/demos/ChatOnHeroku/lib/python2.7/site-packages/gunicorn/util.py", line 292, in import_app
11:22:45 web.1  |     app = eval(obj, mod.__dict__)
11:22:45 web.1  |   File "<string>", line 1, in <module>
11:22:45 web.1  | NameError: name 'application' is not defined
11:22:45 web.1  | 2012-11-12 11:22:45 [18442] [INFO] Worker exiting (pid: 18442)
11:22:45 web.1  | 2012-11-12 11:22:45 [18443] [ERROR] Exception in worker process:
11:22:45 web.1  | Traceback (most recent call last):
11:22:45 web.1  |   File "/Users/princekumar/Downloads/tornado-2.4/demos/ChatOnHeroku/lib/python2.7/site-packages/gunicorn/arbiter.py", line 461, in spawn_worker
11:22:45 web.1  |     worker.init_process()
11:22:45 web.1  |   File "/Users/princekumar/Downloads/tornado-2.4/demos/ChatOnHeroku/lib/python2.7/site-packages/gunicorn/workers/base.py", line 101, in init_process
11:22:45 web.1  |     self.wsgi = self.app.wsgi()
11:22:45 web.1  |   File "/Users/princekumar/Downloads/tornado-2.4/demos/ChatOnHeroku/lib/python2.7/site-packages/gunicorn/app/base.py", line 101, in wsgi
11:22:45 web.1  |     self.callable = self.load()
11:22:45 web.1  |   File "/Users/princekumar/Downloads/tornado-2.4/demos/ChatOnHeroku/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 24, in load
11:22:45 web.1  |     return util.import_app(self.app_uri)
11:22:45 web.1  |   File "/Users/princekumar/Downloads/tornado-2.4/demos/ChatOnHeroku/lib/python2.7/site-packages/gunicorn/util.py", line 292, in import_app
11:22:45 web.1  |     app = eval(obj, mod.__dict__)
11:22:45 web.1  |   File "<string>", line 1, in <module>
11:22:45 web.1  | NameError: name 'application' is not defined
11:22:45 web.1  | Traceback (most recent call last):
11:22:45 web.1  |   File "/Users/princekumar/Downloads/tornado-2.4/demos/ChatOnHeroku/lib/python2.7/site-packages/gunicorn/arbiter.py", line 461, in spawn_worker
11:22:45 web.1  |     worker.init_process()
11:22:45 web.1  |   File "/Users/princekumar/Downloads/tornado-2.4/demos/ChatOnHeroku/lib/python2.7/site-packages/gunicorn/workers/base.py", line 101, in init_process
11:22:45 web.1  |     self.wsgi = self.app.wsgi()
11:22:45 web.1  |   File "/Users/princekumar/Downloads/tornado-2.4/demos/ChatOnHeroku/lib/python2.7/site-packages/gunicorn/app/base.py", line 101, in wsgi
11:22:45 web.1  |     self.callable = self.load()
11:22:45 web.1  |   File "/Users/princekumar/Downloads/tornado-2.4/demos/ChatOnHeroku/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 24, in load
11:22:45 web.1  |     return util.import_app(self.app_uri)
11:22:45 web.1  |   File "/Users/princekumar/Downloads/tornado-2.4/demos/ChatOnHeroku/lib/python2.7/site-packages/gunicorn/util.py", line 292, in import_app
11:22:45 web.1  |     app = eval(obj, mod.__dict__)
11:22:45 web.1  |   File "<string>", line 1, in <module>
11:22:45 web.1  | NameError: name 'application' is not defined
11:22:45 web.1  | 2012-11-12 11:22:45 [18443] [INFO] Worker exiting (pid: 18443)
11:22:45 web.1  | 2012-11-12 11:22:45 [18444] [ERROR] Exception in worker process:
11:22:45 web.1  | Traceback (most recent call last):
11:22:45 web.1  |   File "/Users/princekumar/Downloads/tornado-2.4/demos/ChatOnHeroku/lib/python2.7/site-packages/gunicorn/arbiter.py", line 461, in spawn_worker
11:22:45 web.1  |     worker.init_process()
11:22:45 web.1  |   File "/Users/princekumar/Downloads/tornado-2.4/demos/ChatOnHeroku/lib/python2.7/site-packages/gunicorn/workers/base.py", line 101, in init_process
11:22:45 web.1  |     self.wsgi = self.app.wsgi()
11:22:45 web.1  |   File "/Users/princekumar/Downloads/tornado-2.4/demos/ChatOnHeroku/lib/python2.7/site-packages/gunicorn/app/base.py", line 101, in wsgi
11:22:45 web.1  |     self.callable = self.load()
11:22:45 web.1  |   File "/Users/princekumar/Downloads/tornado-2.4/demos/ChatOnHeroku/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 24, in load
11:22:45 web.1  |     return util.import_app(self.app_uri)
11:22:45 web.1  |   File "/Users/princekumar/Downloads/tornado-2.4/demos/ChatOnHeroku/lib/python2.7/site-packages/gunicorn/util.py", line 292, in import_app
11:22:45 web.1  |     app = eval(obj, mod.__dict__)
11:22:45 web.1  |   File "<string>", line 1, in <module>
11:22:45 web.1  | NameError: name 'application' is not defined
11:22:45 web.1  | Traceback (most recent call last):
11:22:45 web.1  |   File "/Users/princekumar/Downloads/tornado-2.4/demos/ChatOnHeroku/lib/python2.7/site-packages/gunicorn/arbiter.py", line 461, in spawn_worker
11:22:45 web.1  |     worker.init_process()
11:22:45 web.1  |   File "/Users/princekumar/Downloads/tornado-2.4/demos/ChatOnHeroku/lib/python2.7/site-packages/gunicorn/workers/base.py", line 101, in init_process
11:22:45 web.1  |     self.wsgi = self.app.wsgi()
11:22:45 web.1  |   File "/Users/princekumar/Downloads/tornado-2.4/demos/ChatOnHeroku/lib/python2.7/site-packages/gunicorn/app/base.py", line 101, in wsgi
11:22:45 web.1  |     self.callable = self.load()
11:22:45 web.1  |   File "/Users/princekumar/Downloads/tornado-2.4/demos/ChatOnHeroku/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 24, in load
11:22:45 web.1  |     return util.import_app(self.app_uri)
11:22:45 web.1  |   File "/Users/princekumar/Downloads/tornado-2.4/demos/ChatOnHeroku/lib/python2.7/site-packages/gunicorn/util.py", line 292, in import_app
11:22:45 web.1  |     app = eval(obj, mod.__dict__)
11:22:45 web.1  |   File "<string>", line 1, in <module>
11:22:45 web.1  | NameError: name 'application' is not defined
11:22:45 web.1  | 2012-11-12 11:22:45 [18444] [INFO] Worker exiting (pid: 18444)
11:22:45 web.1  | 2012-11-12 11:22:45 [18445] [ERROR] Exception in worker process:
11:22:45 web.1  | Traceback (most recent call last):
11:22:45 web.1  |   File "/Users/princekumar/Downloads/tornado-2.4/demos/ChatOnHeroku/lib/python2.7/site-packages/gunicorn/arbiter.py", line 461, in spawn_worker
11:22:45 web.1  |     worker.init_process()
11:22:45 web.1  |   File "/Users/princekumar/Downloads/tornado-2.4/demos/ChatOnHeroku/lib/python2.7/site-packages/gunicorn/workers/base.py", line 101, in init_process
11:22:45 web.1  |     self.wsgi = self.app.wsgi()
11:22:45 web.1  |   File "/Users/princekumar/Downloads/tornado-2.4/demos/ChatOnHeroku/lib/python2.7/site-packages/gunicorn/app/base.py", line 101, in wsgi
11:22:45 web.1  |     self.callable = self.load()
11:22:45 web.1  |   File "/Users/princekumar/Downloads/tornado-2.4/demos/ChatOnHeroku/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 24, in load
11:22:45 web.1  |     return util.import_app(self.app_uri)
11:22:45 web.1  |   File "/Users/princekumar/Downloads/tornado-2.4/demos/ChatOnHeroku/lib/python2.7/site-packages/gunicorn/util.py", line 292, in import_app
11:22:45 web.1  |     app = eval(obj, mod.__dict__)
11:22:45 web.1  |   File "<string>", line 1, in <module>
11:22:45 web.1  | NameError: name 'application' is not defined
11:22:45 web.1  | Traceback (most recent call last):
11:22:45 web.1  |   File "/Users/princekumar/Downloads/tornado-2.4/demos/ChatOnHeroku/lib/python2.7/site-packages/gunicorn/arbiter.py", line 461, in spawn_worker
11:22:45 web.1  |     worker.init_process()
11:22:45 web.1  |   File "/Users/princekumar/Downloads/tornado-2.4/demos/ChatOnHeroku/lib/python2.7/site-packages/gunicorn/workers/base.py", line 101, in init_process
11:22:45 web.1  |     self.wsgi = self.app.wsgi()
11:22:45 web.1  |   File "/Users/princekumar/Downloads/tornado-2.4/demos/ChatOnHeroku/lib/python2.7/site-packages/gunicorn/app/base.py", line 101, in wsgi
11:22:45 web.1  |     self.callable = self.load()
11:22:45 web.1  |   File "/Users/princekumar/Downloads/tornado-2.4/demos/ChatOnHeroku/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 24, in load
11:22:45 web.1  |     return util.import_app(self.app_uri)
11:22:45 web.1  |   File "/Users/princekumar/Downloads/tornado-2.4/demos/ChatOnHeroku/lib/python2.7/site-packages/gunicorn/util.py", line 292, in import_app
11:22:45 web.1  |     app = eval(obj, mod.__dict__)
11:22:45 web.1  |   File "<string>", line 1, in <module>
11:22:45 web.1  | NameError: name 'application' is not defined
11:22:45 web.1  | 2012-11-12 11:22:45 [18445] [INFO] Worker exiting (pid: 18445)
11:22:45 web.1  | Traceback (most recent call last):
11:22:45 web.1  |   File "/Users/princekumar/Downloads/tornado-2.4/demos/ChatOnHeroku/bin/gunicorn", line 8, in <module>
11:22:45 web.1  |     load_entry_point('gunicorn==0.15.0', 'console_scripts', 'gunicorn')()
11:22:45 web.1  |   File "/Users/princekumar/Downloads/tornado-2.4/demos/ChatOnHeroku/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 32, in run
11:22:45 web.1  |     WSGIApplication("%prog [OPTIONS] APP_MODULE").run()
11:22:45 web.1  |   File "/Users/princekumar/Downloads/tornado-2.4/demos/ChatOnHeroku/lib/python2.7/site-packages/gunicorn/app/base.py", line 124, in run
11:22:45 web.1  |     Arbiter(self).run()
11:22:45 web.1  |   File "/Users/princekumar/Downloads/tornado-2.4/demos/ChatOnHeroku/lib/python2.7/site-packages/gunicorn/arbiter.py", line 185, in run
11:22:45 web.1  |     self.halt(reason=inst.reason, exit_status=inst.exit_status)
11:22:45 web.1  |   File "/Users/princekumar/Downloads/tornado-2.4/demos/ChatOnHeroku/lib/python2.7/site-packages/gunicorn/arbiter.py", line 280, in halt
11:22:45 web.1  |     self.stop()
11:22:45 web.1  |   File "/Users/princekumar/Downloads/tornado-2.4/demos/ChatOnHeroku/lib/python2.7/site-packages/gunicorn/arbiter.py", line 328, in stop
11:22:45 web.1  |     self.reap_workers()
11:22:45 web.1  |   File "/Users/princekumar/Downloads/tornado-2.4/demos/ChatOnHeroku/lib/python2.7/site-packages/gunicorn/arbiter.py", line 421, in reap_workers
11:22:45 web.1  |     raise HaltServer(reason, self.WORKER_BOOT_ERROR)
11:22:45 web.1  | gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>
11:22:45 web.1  | exited with code 1
11:22:45 system | sending SIGTERM to all processes
SIGTERM received

有人知道怎么了吗?

4

3 回答 3

2

检查你的procfilerequirements.txt。如果有人在看,这里是部署在 Heroku 上的相同官方聊天演示的一个工作示例

于 2014-07-12T09:31:06.123 回答
1

您的 Procfile 应包含以下内容:

 web: python app.py

(将 app.py 替换为“chatdemo.py”或您的应用名称)

于 2016-09-23T13:07:43.510 回答
1

截至 2021 年 7 月,@avi 和 @apoclyps 提供的答案在 Tornado 6.1 上仍然可以正常工作。

我的 Tornado 网络应用程序的 Procfile 出现在下面。它也适用于 AWS:

web: python application.py --port=$port --logging=error

于 2021-07-22T23:20:03.507 回答