Heroku无法查看应用程序

2024-05-28 20:33:24 发布

您现在位置:Python中文网/ 问答频道 /正文

Edit: Problem solved.

我使用python和flask创建了一个基本应用程序。我已经将应用程序部署到heroku,heroku没有引发任何异常或错误。但当我打开我的应用程序时,我会收到一条消息“应用程序错误”。 该应用程序在我的本地主机和pythonanywhere.com上运行良好

我也在网上和stackoverflow上寻找一些解决方案。没有找到任何解决问题的方法

Procfile

web:gunicorn yesillcs:app

yesillcs.py

from flask import Flask, render_template

app = Flask(__name__)

@app.route("/")
def page_index():
    return render_template('index.html')

@app.route("/notifications")
def page_notifications():
    return render_template('notifications.html')

@app.route("/login")
def page_login():
    return render_template('login.html')

@app.route("/logs")
def page_logs():
    return render_template('logs.html')

if __name__ == "__main__":
    app.run()

requirements.txt

altgraph==0.16.1
asgiref==3.2.7
asn1crypto==1.3.0
atomicwrites==1.3.0
attrs==19.3.0
Automat==0.8.0
backcall==0.1.0
backports.functools-lru-cache==1.6.1
backports.tempfile==1.0
backports.weakref==1.0.post1
bcrypt==3.1.7
beautifulsoup4==4.8.2
bleach==3.1.0
certifi==2020.4.5.1
cffi==1.14.0
chardet==3.0.4
click==7.1.1
cloudpickle==1.3.0
colorama==0.4.3
constantly==15.1.0
cryptography==2.8
cssselect==1.1.0
cycler==0.10.0
decorator==4.4.2
defusedxml==0.6.0
deploy==1.9.1
Django==3.0.5
EasyProcess==0.2.10
entrypoint2==0.2
entrypoints==0.3
filelock==3.0.12
Flask==1.1.2
future==0.18.2
glob2==0.7
gunicorn==20.0.4
hyperlink==19.0.0
idna==2.9
importlib-metadata==1.5.0
incremental==17.5.0
ipykernel==5.1.4
ipython==7.13.0
ipython-genutils==0.2.0
ipywidgets==7.5.1
itsdangerous==1.1.0
jedi==0.16.0
Jinja2==2.11.1
joblib==0.14.1
json5==0.9.3
jsonschema==3.2.0
jupyter-client==6.1.0
jupyter-core==4.6.1
jupyterlab==1.2.6
jupyterlab-server==1.0.7
jupyterthemes==0.20.0
kiwisolver==1.1.0
lesscpy==0.14.0
libarchive-c==2.8
lxml==4.5.0
MarkupSafe==1.1.1
matplotlib==3.2.1
mistune==0.8.4
more-itertools==8.2.0
MouseInfo==0.1.2
mss==5.0.0
nbconvert==5.6.1
nbformat==5.0.4
notebook==6.0.3
numpy==1.18.2
olefile==0.46
packaging==20.3
pandas==1.0.3
pandocfilters==1.4.2
parsel==1.5.2
parso==0.6.2
pefile==2019.4.18
pickleshare==0.7.5
Pillow==7.0.0
pkginfo==1.5.0.1
pluggy==0.13.1
ply==3.11
prometheus-client==0.7.1
prompt-toolkit==3.0.4
Protego==0.1.16
psutil==5.7.0
py==1.8.1
pyasn1==0.4.8
pyasn1-modules==0.2.7
PyAutoGUI==0.9.48
pycosat==0.6.3
pycparser==2.20
PyDispatcher==2.0.5
PyGetWindow==0.0.8
Pygments==2.6.1
PyHamcrest==1.9.0
PyInstaller==3.5
PyMsgBox==1.0.7
pynput==1.6.7
pyOpenSSL==19.1.0
pyparsing==2.4.6
pyperclip==1.7.0
PyQt5==5.13.2
PyQt5-sip==12.7.0
PyRect==0.1.4
pyrsistent==0.15.7
pyscreenshot==1.0
PyScreeze==0.1.26
PySocks==1.7.1
pytest==5.4.1
pytest-runner==5.2
python-dateutil==2.8.1
PyTweening==1.0.3
pytz==2019.3
pywinpty==0.5.7
PyYAML==5.3.1
pyzmq==18.1.1
QtPy==1.9.0
queuelib==1.5.0
requests==2.23.0
ruamel-yaml==0.15.87
scikit-learn==0.22.2.post1
scipy==1.4.1
Scrapy==1.6.0
selenium==3.141.0
Send2Trash==1.5.0
service-identity==18.1.0
six==1.14.0
sklearn==0.0
soupsieve==2.0
spyder-kernels==0.5.2
sqlparse==0.3.1
terminado==0.8.3
testpath==0.4.4
tornado==6.0.4
tqdm==4.43.0
traitlets==4.3.3
Twisted==19.10.0
urllib3==1.25.8
virtualenv==16.7.9
w3lib==1.21.0
wcwidth==0.1.8
webencodings==0.5.1
Werkzeug==1.0.1
widgetsnbextension==3.5.1
win-inet-pton==1.1.0
wincertstore==0.2
xmltodict==0.12.0
zipp==2.2.0
zope.interface==4.7.1

heroku应用程序日志

2020-04-12T13:35:09.966881+00:00 app[web.1]: [2020-04-12 13:35:09 +0000] [4] [INFO] Starting gunicorn 20.0.4
2020-04-12T13:35:09.967598+00:00 app[web.1]: [2020-04-12 13:35:09 +0000] [4] [INFO] Listening at: http://0.0.0.0:53385 (4)
2020-04-12T13:35:09.967686+00:00 app[web.1]: [2020-04-12 13:35:09 +0000] [4] [INFO] Using worker: sync
2020-04-12T13:35:09.971517+00:00 app[web.1]: [2020-04-12 13:35:09 +0000] [10] [INFO] Booting worker with pid: 10
2020-04-12T13:35:09.983592+00:00 app[web.1]: [2020-04-12 13:35:09 +0000] [11] [INFO] Booting worker with pid: 11
2020-04-12T13:35:10.115074+00:00 app[web.1]: * Serving Flask app "yesillcs" (lazy loading)
2020-04-12T13:35:10.115111+00:00 app[web.1]: * Environment: production
2020-04-12T13:35:10.115218+00:00 app[web.1]: WARNING: This is a development server. Do not use it in a production deployment.
2020-04-12T13:35:10.115297+00:00 app[web.1]: Use a production WSGI server instead.
2020-04-12T13:35:10.115339+00:00 app[web.1]: * Debug mode: off
2020-04-12T13:35:10.117822+00:00 app[web.1]: * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
2020-04-12T13:35:10.129262+00:00 app[web.1]: * Serving Flask app "yesillcs" (lazy loading)
2020-04-12T13:35:10.129348+00:00 app[web.1]: * Environment: production
2020-04-12T13:35:10.129430+00:00 app[web.1]: WARNING: This is a development server. Do not use it in a production deployment.
2020-04-12T13:35:10.129482+00:00 app[web.1]: Use a production WSGI server instead.
2020-04-12T13:35:10.129548+00:00 app[web.1]: * Debug mode: off
2020-04-12T13:35:10.134698+00:00 app[web.1]: [2020-04-12 13:35:10 +0000] [11] [ERROR] Exception in worker process
2020-04-12T13:35:10.134699+00:00 app[web.1]: Traceback (most recent call last):
2020-04-12T13:35:10.134705+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
2020-04-12T13:35:10.134705+00:00 app[web.1]: worker.init_process()
2020-04-12T13:35:10.134705+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/workers/base.py", line 119, in init_process
2020-04-12T13:35:10.134706+00:00 app[web.1]: self.load_wsgi()
2020-04-12T13:35:10.134706+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi
2020-04-12T13:35:10.134707+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2020-04-12T13:35:10.134707+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
2020-04-12T13:35:10.134707+00:00 app[web.1]: self.callable = self.load()
2020-04-12T13:35:10.134708+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
2020-04-12T13:35:10.134708+00:00 app[web.1]: return self.load_wsgiapp()
2020-04-12T13:35:10.134708+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
2020-04-12T13:35:10.134709+00:00 app[web.1]: return util.import_app(self.app_uri)
2020-04-12T13:35:10.134709+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/gunicorn/util.py", line 358, in import_app
2020-04-12T13:35:10.134709+00:00 app[web.1]: mod = importlib.import_module(module)
2020-04-12T13:35:10.134710+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/importlib/__init__.py", line 127, in import_module
2020-04-12T13:35:10.134710+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2020-04-12T13:35:10.134710+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
2020-04-12T13:35:10.134711+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 983, in _find_and_load
2020-04-12T13:35:10.134711+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
2020-04-12T13:35:10.134711+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
2020-04-12T13:35:10.134712+00:00 app[web.1]: File "<frozen importlib._bootstrap_external>", line 728, in exec_module
2020-04-12T13:35:10.134712+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
2020-04-12T13:35:10.134712+00:00 app[web.1]: File "/app/yesillcs.py", line 21, in <module>
2020-04-12T13:35:10.134723+00:00 app[web.1]: app.run()
2020-04-12T13:35:10.134723+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/flask/app.py", line 990, in run
2020-04-12T13:35:10.134724+00:00 app[web.1]: run_simple(host, port, self, **options)
2020-04-12T13:35:10.134724+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/werkzeug/serving.py", line 1052, in run_simple
2020-04-12T13:35:10.134724+00:00 app[web.1]: inner()
2020-04-12T13:35:10.134725+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/werkzeug/serving.py", line 1005, in inner
2020-04-12T13:35:10.134725+00:00 app[web.1]: fd=fd,
2020-04-12T13:35:10.134725+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/werkzeug/serving.py", line 848, in make_server
2020-04-12T13:35:10.134726+00:00 app[web.1]: host, port, app, request_handler, passthrough_errors, ssl_context, fd=fd
2020-04-12T13:35:10.134726+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/site-packages/werkzeug/serving.py", line 740, in __init__
2020-04-12T13:35:10.134727+00:00 app[web.1]: HTTPServer.__init__(self, server_address, handler)
2020-04-12T13:35:10.134727+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/socketserver.py", line 452, in __init__
2020-04-12T13:35:10.134727+00:00 app[web.1]: self.server_bind()
2020-04-12T13:35:10.134728+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/http/server.py", line 137, in server_bind
2020-04-12T13:35:10.134728+00:00 app[web.1]: socketserver.TCPServer.server_bind(self)
2020-04-12T13:35:10.134728+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.7/socketserver.py", line 466, in server_bind
2020-04-12T13:35:10.134729+00:00 app[web.1]: self.socket.bind(self.server_address)
2020-04-12T13:35:10.134729+00:00 app[web.1]: OSError: [Errno 98] Address already in use
2020-04-12T13:35:10.134883+00:00 app[web.1]: [2020-04-12 13:35:10 +0000] [11] [INFO] Worker exiting (pid: 11)
2020-04-12T13:35:40.430487+00:00 heroku[web.1]: State changed from up to crashed
2020-04-12T13:35:40.262665+00:00 app[web.1]: [2020-04-12 13:35:40 +0000] [4] [INFO] Shutting down: Master
2020-04-12T13:35:40.262804+00:00 app[web.1]: [2020-04-12 13:35:40 +0000] [4] [INFO] Reason: Worker failed to boot.
2020-04-12T13:35:42.000000+00:00 app[api]: Build started by user yslmehmetbm@gmail.com
2020-04-12T13:38:52.074998+00:00 app[api]: Deploy 1867fefa by user yslmehmetbm@gmail.com
2020-04-12T13:38:52.074998+00:00 app[api]: Release v14 created by user yslmehmetbm@gmail.com
2020-04-12T13:38:52.430527+00:00 heroku[web.1]: State changed from crashed to down
2020-04-12T13:39:41.000000+00:00 app[api]: Build succeeded
2020-04-12T13:44:49.877692+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=yesillcs.herokuapp.com request_id=d270d744-0a15-4475-b299-b4638053641f fwd="193.192.127.211" dyno= connect= service= status=503 bytes= protocol=https
2020-04-12T13:44:50.140187+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=yesillcs.herokuapp.com request_id=56ff21a4-f437-4ece-962e-9d128c85acbc fwd="193.192.127.211" dyno= connect= service= status=503 bytes= protocol=https
2020-04-12T13:44:50.989105+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=yesillcs.herokuapp.com request_id=5a5d9660-166f-4848-ab58-f92f22bc3fd2 fwd="193.192.127.211" dyno= connect= service= status=503 bytes= protocol=https
2020-04-12T13:44:51.251692+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=yesillcs.herokuapp.com request_id=f28286c5-9895-43f1-b36b-ffa611eafd6f fwd="193.192.127.211" dyno= connect= service= status=503 bytes= protocol=https
2020-04-12T13:44:51.787802+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=yesillcs.herokuapp.com request_id=af414881-b695-44a8-ad32-5c57deb58618 fwd="193.192.127.211" dyno= connect= service= status=503 bytes= protocol=https
2020-04-12T13:44:52.042170+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=yesillcs.herokuapp.com request_id=bde6609b-4b10-434f-a707-30f669854269 fwd="193.192.127.211" dyno= connect= service= status=503 bytes= protocol=https
2020-04-12T13:44:53.067049+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=yesillcs.herokuapp.com request_id=d3461e08-df38-44f6-8ee8-c4c82e2a8d0d fwd="193.192.127.211" dyno= connect= service= status=503 bytes= protocol=https
2020-04-12T13:44:53.338023+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=yesillcs.herokuapp.com request_id=91d64000-ff09-4322-921a-bc369f458037 fwd="193.192.127.211" dyno= connect= service= status=503 bytes= protocol=https
2020-04-12T13:50:59.815818+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=yesillcs.herokuapp.com request_id=7b244302-43e2-4b0f-bc6c-a396c4ecb5b7 fwd="193.192.127.211" dyno= connect= service= status=503 bytes= protocol=https
2020-04-12T13:51:00.064212+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=yesillcs.herokuapp.com request_id=7f15b496-1b71-4eec-bf51-9feda781915d fwd="193.192.127.211" dyno= connect= service= status=503 bytes= protocol=https
2020-04-12T13:55:39.000000+00:00 app[api]: Build started by user yslmehmetbm@gmail.com
2020-04-12T13:58:45.595752+00:00 app[api]: Deploy 993b5b98 by user yslmehmetbm@gmail.com
2020-04-12T13:58:45.595752+00:00 app[api]: Release v15 created by user yslmehmetbm@gmail.com
2020-04-12T13:59:32.000000+00:00 app[api]: Build succeeded
2020-04-12T14:01:34.536064+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=yesillcs.herokuapp.com request_id=840ff016-de97-47b7-bdcd-fcefb993cc00 fwd="193.192.127.211" dyno= connect= service= status=503 bytes= protocol=https
2020-04-12T14:01:34.782067+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=yesillcs.herokuapp.com request_id=ef256f0d-b57c-473e-9f38-6bad28c73ff8 fwd="193.192.127.211" dyno= connect= service= status=503 bytes= protocol=https
2020-04-12T14:01:35.681316+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=yesillcs.herokuapp.com request_id=88221236-47cf-44e8-a89b-c48ed82fa35a fwd="193.192.127.211" dyno= connect= service= status=503 bytes= protocol=https
2020-04-12T14:01:35.951558+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=yesillcs.herokuapp.com request_id=62132847-a7f8-4467-a67b-8962c67ce201 fwd="193.192.127.211" dyno= connect= service= status=503 bytes= protocol=https
2020-04-12T14:01:36.907961+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=yesillcs.herokuapp.com request_id=9e7863ba-850d-474c-a667-cbe9e4a2a54d fwd="193.192.127.211" dyno= connect= service= status=503 bytes= protocol=https
2020-04-12T14:01:37.163856+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=yesillcs.herokuapp.com request_id=a20c9451-8cb2-423c-8af1-fce5e2443470 fwd="193.192.127.211" dyno= connect= service= status=503 bytes= protocol=https
2020-04-12T14:14:21.162950+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=yesillcs.herokuapp.com request_id=d581afa9-9fe7-4d74-8399-a23e0376f8f7 fwd="193.192.127.211" dyno= connect= service= status=503 bytes= protocol=https
2020-04-12T14:14:21.408407+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=yesillcs.herokuapp.com request_id=d20b0c3b-721e-4903-bf6d-a927e1d054e9 fwd="193.192.127.211" dyno= connect= service= status=503 bytes= protocol=https
2020-04-12T14:17:40.076765+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=yesillcs.herokuapp.com request_id=2cc8055b-a251-49d2-a003-6c448fd31f8a fwd="193.192.127.211" dyno= connect= service= status=503 bytes= protocol=https
2020-04-12T14:17:40.339636+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=yesillcs.herokuapp.com request_id=fa4b89cd-6724-48b5-a6b3-9847d81acc14 fwd="193.192.127.211" dyno= connect= service= status=503 bytes= protocol=https
2020-04-12T14:23:21.000000+00:00 app[api]: Build started by user yslmehmetbm@gmail.com
2020-04-12T14:23:26.505831+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=yesillcs.herokuapp.com request_id=67867da3-847f-40a5-95a0-d7cffbece0d0 fwd="193.192.127.211" dyno= connect= service= status=503 bytes= protocol=https
2020-04-12T14:23:26.760972+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=yesillcs.herokuapp.com request_id=9ece75d5-da29-4968-a384-51006ac05032 fwd="193.192.127.211" dyno= connect= service= status=503 bytes= protocol=https
2020-04-12T14:26:47.560783+00:00 app[api]: Deploy 13fe6de2 by user yslmehmetbm@gmail.com
2020-04-12T14:26:47.560783+00:00 app[api]: Release v16 created by user yslmehmetbm@gmail.com
2020-04-12T14:27:41.000000+00:00 app[api]: Build succeeded
2020-04-12T14:28:49.330334+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" host=yesillcs.herokuapp.com request_id=86c62836-d1a6-4666-ac71-5dc38dcf0cec fwd="193.192.127.211" dyno= connect= service= status=503 bytes= protocol=https
2020-04-12T14:28:49.637281+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/favicon.ico" host=yesillcs.herokuapp.com request_id=63959637-6761-4c32-83dc-ff598a8a5a0d fwd="193.192.127.211" dyno= connect= service= status=503 bytes= protocol=https

Tags: incomwebapphostherokurequestservice
2条回答

Heroku正在动态分配Gunicorn应在其上为您的应用程序提供服务的端口。您没有告诉Gunicorn连接此端口。更新Procfile,使其看起来像这样

Procfile

web: gunicorn  bind 0.0.0.0:$PORT yesillcs:app

您的Procfile应该更改为重复“module:app name”格式,因此指向您的python文件/模块。在这里:

web:gunicorn yesillcs:app

(您的Procfile现在是web:gunicorn deploy:app,因此heroku正在deploy.py中查找app-这在您的repo中不存在)

相关问题 更多 >

    热门问题