我正在尝试运行heroku,但似乎无法运行该应用程序。
错误日志指出:
Last login: Sun Jan 12 09:37:02 on ttys001
(base) adam:dash adam$ heroku logs --tail
› Warning: heroku update available from 7.35.0 to 7.35.1.
2020-01-12T14:36:05.716972+00:00 app[web.1]: [2020-01-12 14:36:05 +0000] [10] [INFO] Worker exiting (pid: 10)
2020-01-12T14:36:06.163957+00:00 app[web.1]: [2020-01-12 14:36:06 +0000] [4] [INFO] Shutting down: Master
2020-01-12T14:36:06.164141+00:00 app[web.1]: [2020-01-12 14:36:06 +0000] [4] [INFO] Reason: Worker failed to boot.
2020-01-12T14:36:06.316849+00:00 heroku[web.1]: State changed from up to crashed
2020-01-12T14:36:06.321823+00:00 heroku[web.1]: State changed from crashed to starting
2020-01-12T14:36:06.294266+00:00 heroku[web.1]: Process exited with status 3
2020-01-12T14:36:07.000000+00:00 app[api]: Build succeeded
2020-01-12T14:36:13.134727+00:00 heroku[web.1]: Starting process with command `gunicorn app:server`
2020-01-12T14:36:15.150029+00:00 app[web.1]: [2020-01-12 14:36:15 +0000] [4] [INFO] Starting gunicorn 20.0.4
2020-01-12T14:36:15.150722+00:00 app[web.1]: [2020-01-12 14:36:15 +0000] [4] [INFO] Listening at: http://0.0.0.0:18933 (4)
2020-01-12T14:36:15.150846+00:00 app[web.1]: [2020-01-12 14:36:15 +0000] [4] [INFO] Using worker: sync
2020-01-12T14:36:15.155588+00:00 app[web.1]: [2020-01-12 14:36:15 +0000] [10] [INFO] Booting worker with pid: 10
2020-01-12T14:36:15.246525+00:00 app[web.1]: [2020-01-12 14:36:15 +0000] [11] [INFO] Booting worker with pid: 11
2020-01-12T14:36:15.848064+00:00 heroku[web.1]: State changed from starting to up
2020-01-12T14:36:16.580950+00:00 app[web.1]: [2020-01-12 14:36:16 +0000] [10] [ERROR] Exception in worker process
2020-01-12T14:36:16.580989+00:00 app[web.1]: Traceback (most recent call last):
2020-01-12T14:36:16.580992+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
2020-01-12T14:36:16.580995+00:00 app[web.1]: worker.init_process()
2020-01-12T14:36:16.580997+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 119, in init_process
2020-01-12T14:36:16.581000+00:00 app[web.1]: self.load_wsgi()
2020-01-12T14:36:16.581001+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi
2020-01-12T14:36:16.581003+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2020-01-12T14:36:16.581005+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 67, in wsgi
2020-01-12T14:36:16.581007+00:00 app[web.1]: self.callable = self.load()
2020-01-12T14:36:16.581009+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
2020-01-12T14:36:16.581011+00:00 app[web.1]: return self.load_wsgiapp()
2020-01-12T14:36:16.581013+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
2020-01-12T14:36:16.581015+00:00 app[web.1]: return util.import_app(self.app_uri)
2020-01-12T14:36:16.581017+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/util.py", line 358, in import_app
2020-01-12T14:36:16.581019+00:00 app[web.1]: mod = importlib.import_module(module)
2020-01-12T14:36:16.581023+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/importlib/__init__.py", line 126, in import_module
2020-01-12T14:36:16.581025+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2020-01-12T14:36:16.581027+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 994, in _gcd_import
2020-01-12T14:36:16.581028+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 971, in _find_and_load
2020-01-12T14:36:16.581030+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
2020-01-12T14:36:16.581031+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
2020-01-12T14:36:16.581032+00:00 app[web.1]: File "<frozen importlib._bootstrap_external>", line 678, in exec_module
2020-01-12T14:36:16.581034+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
2020-01-12T14:36:16.581035+00:00 app[web.1]: File "/app/app.py", line 8, in <module>
2020-01-12T14:36:16.581037+00:00 app[web.1]: df = pd.read_csv("/Users/adam31/Desktop/abc.csv")
2020-01-12T14:36:16.581038+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/pandas/io/parsers.py", line 685, in parser_f
2020-01-12T14:36:16.581040+00:00 app[web.1]: return _read(filepath_or_buffer, kwds)
2020-01-12T14:36:16.581041+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/pandas/io/parsers.py", line 457, in _read
2020-01-12T14:36:16.581043+00:00 app[web.1]: parser = TextFileReader(fp_or_buf, **kwds)
2020-01-12T14:36:16.581044+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/pandas/io/parsers.py", line 895, in __init__
2020-01-12T14:36:16.581046+00:00 app[web.1]: self._make_engine(self.engine)
2020-01-12T14:36:16.581047+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/pandas/io/parsers.py", line 1135, in _make_engine
2020-01-12T14:36:16.581049+00:00 app[web.1]: self._engine = CParserWrapper(self.f, **self.options)
2020-01-12T14:36:16.581050+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/pandas/io/parsers.py", line 1917, in __init__
2020-01-12T14:36:16.581052+00:00 app[web.1]: self._reader = parsers.TextReader(src, **kwds)
2020-01-12T14:36:16.581053+00:00 app[web.1]: File "pandas/_libs/parsers.pyx", line 382, in pandas._libs.parsers.TextReader.__cinit__
2020-01-12T14:36:16.581055+00:00 app[web.1]: File "pandas/_libs/parsers.pyx", line 689, in pandas._libs.parsers.TextReader._setup_parser_source
2020-01-12T14:36:16.581063+00:00 app[web.1]: FileNotFoundError: [Errno 2] File b'/Users/adam31/Desktop/abc.csv' does not exist: b'/Users/adam31/Desktop/abc.csv'
2020-01-12T14:36:16.581454+00:00 app[web.1]: [2020-01-12 14:36:16 +0000] [10] [INFO] Worker exiting (pid: 10)
2020-01-12T14:36:16.670227+00:00 app[web.1]: [2020-01-12 14:36:16 +0000] [11] [ERROR] Exception in worker process
2020-01-12T14:36:16.670231+00:00 app[web.1]: Traceback (most recent call last):
2020-01-12T14:36:16.670236+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
2020-01-12T14:36:16.670238+00:00 app[web.1]: worker.init_process()
2020-01-12T14:36:16.670240+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 119, in init_process
2020-01-12T14:36:16.670242+00:00 app[web.1]: self.load_wsgi()
2020-01-12T14:36:16.670244+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi
2020-01-12T14:36:16.670246+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2020-01-12T14:36:16.670248+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 67, in wsgi
2020-01-12T14:36:16.670250+00:00 app[web.1]: self.callable = self.load()
2020-01-12T14:36:16.670252+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
2020-01-12T14:36:16.670254+00:00 app[web.1]: return self.load_wsgiapp()
2020-01-12T14:36:16.670256+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
2020-01-12T14:36:16.670258+00:00 app[web.1]: return util.import_app(self.app_uri)
2020-01-12T14:36:16.670260+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/util.py", line 358, in import_app
2020-01-12T14:36:16.670262+00:00 app[web.1]: mod = importlib.import_module(module)
2020-01-12T14:36:16.670264+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/importlib/__init__.py", line 126, in import_module
2020-01-12T14:36:16.670266+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2020-01-12T14:36:16.670269+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 994, in _gcd_import
2020-01-12T14:36:16.670271+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 971, in _find_and_load
2020-01-12T14:36:16.670273+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
2020-01-12T14:36:16.670275+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
2020-01-12T14:36:16.670277+00:00 app[web.1]: File "<frozen importlib._bootstrap_external>", line 678, in exec_module
2020-01-12T14:36:16.670279+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
2020-01-12T14:36:16.670281+00:00 app[web.1]: File "/app/app.py", line 8, in <module>
2020-01-12T14:36:16.670283+00:00 app[web.1]: df = pd.read_csv("/Users/adam31/Desktop/abc.csv")
2020-01-12T14:36:16.670285+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/pandas/io/parsers.py", line 685, in parser_f
2020-01-12T14:36:16.670288+00:00 app[web.1]: return _read(filepath_or_buffer, kwds)
2020-01-12T14:36:16.670290+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/pandas/io/parsers.py", line 457, in _read
2020-01-12T14:36:16.670292+00:00 app[web.1]: parser = TextFileReader(fp_or_buf, **kwds)
2020-01-12T14:36:16.670294+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/pandas/io/parsers.py", line 895, in __init__
2020-01-12T14:36:16.670296+00:00 app[web.1]: self._make_engine(self.engine)
2020-01-12T14:36:16.670298+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/pandas/io/parsers.py", line 1135, in _make_engine
2020-01-12T14:36:16.670300+00:00 app[web.1]: self._engine = CParserWrapper(self.f, **self.options)
2020-01-12T14:36:16.670302+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/pandas/io/parsers.py", line 1917, in __init__
2020-01-12T14:36:16.670304+00:00 app[web.1]: self._reader = parsers.TextReader(src, **kwds)
2020-01-12T14:36:16.670306+00:00 app[web.1]: File "pandas/_libs/parsers.pyx", line 382, in pandas._libs.parsers.TextReader.__cinit__
2020-01-12T14:36:16.670308+00:00 app[web.1]: File "pandas/_libs/parsers.pyx", line 689, in pandas._libs.parsers.TextReader._setup_parser_source
2020-01-12T14:36:16.670339+00:00 app[web.1]: FileNotFoundError: [Errno 2] File b'/Users/adam31/Desktop/abc.csv' does not exist: b'/Users/adam31/Desktop/abc.csv'
2020-01-12T14:36:16.670752+00:00 app[web.1]: [2020-01-12 14:36:16 +0000] [11] [INFO] Worker exiting (pid: 11)
2020-01-12T14:36:16.796730+00:00 app[web.1]: [2020-01-12 14:36:16 +0000] [4] [INFO] Shutting down: Master
2020-01-12T14:36:16.796849+00:00 app[web.1]: [2020-01-12 14:36:16 +0000] [4] [INFO] Reason: Worker failed to boot.
2020-01-12T14:36:16.888718+00:00 heroku[web.1]: State changed from up to crashed
2020-01-12T14:36:16.868326+00:00 heroku[web.1]: Process exited with status 3
2020-01-12T14:36:22.387391+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=nba-proj-knox.herokuapp.com request_id=9cda17d1-4bf8-499b-b1d4-61eab9e07ab1 fwd="69.127.72.249" dyno=web.1 connect=5000ms service= status=503 bytes= protocol=https
2020-01-12T14:36:23.365140+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=nba-proj-knox.herokuapp.com request_id=6a9dd876-eb1b-4052-824f-274afc5f183b fwd="69.127.72.249" dyno= connect= service= status=503 bytes= protocol=https
我可以看到它无法从我位于桌面上的应用程序中找到文件-'abc.csv'-但是我可以向您保证它在那里并且文件名输入正确。毕竟-当我在本地运行该应用程序时,它运行完美。当问题出现时,我尝试部署它。
答案 0 :(得分:0)
将应用程序部署到Heroku时,它将托管在无法访问本地计算机或本地计算机文件的服务器上。该应用程序将能够在本地运行良好,因为它可以看到abc.csv文件。
要解决该错误,您需要将abc.csv文件上传到Heroku。如果您使用过git,则可以通过将csv文件上传到存储库并使用相对路径来做到这一点。