[英]Heroku app successfully deploying, but receiving an application error when loading site
The message is that the app was successfully deployed but when I load the app it display this error:消息是应用程序已成功部署,但当我加载应用程序时显示此错误:
An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details. You can do this from the Heroku CLI with the command
My logs are indicating some errors but what is that I am doing wrong?我的日志显示了一些错误,但我做错了什么?
when run:运行时:
$ heroku logs -a disastresponse --tail
$
heroku logs -a disastresponse --tail
this is the output:这是 output:
2022-02-11T04:06:42.642514+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/importlib/__init__.py", line 127, in import_module
2022-02-11T04:06:42.642515+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2022-02-11T04:06:42.642516+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
2022-02-11T04:06:42.642516+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
2022-02-11T04:06:42.642516+00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
2022-02-11T04:06:42.642517+00:00 app[web.1]: ModuleNotFoundError: No module named 'app'
2022-02-11T04:06:42.642579+00:00 app[web.1]: [2022-02-11 04:06:42 +0000] [10] [INFO] Worker exiting (pid: 10)
2022-02-11T04:06:42.676775+00:00 app[web.1]: [2022-02-11 04:06:42 +0000] [4] [WARNING] Worker with pid 10 was terminated due to signal 15
2022-02-11T04:06:42.776963+00:00 app[web.1]: [2022-02-11 04:06:42 +0000] [4] [INFO] Shutting down: Master
2022-02-11T04:06:42.777013+00:00 app[web.1]: [2022-02-11 04:06:42 +0000] [4] [INFO] Reason: Worker failed to boot.
Procfile:简介:
web: gunicorn app:run
requirements.txt要求.txt
flask==2.0.2
gunicorn==20.1.0
joblib==1.1.0
nltk==3.6.5
plotly==5.1.0
numpy==1.22.2
pandas==1.4.0
pip==21.2.4
regex==2021.8.3
scikit-learn==1.0.1
scipy==1.7.3
sqlalchemy==1.4.27
Here all my run.py imports:这是我所有的 run.py 进口:
import json
import plotly
import pandas as pd
import numpy as np
import os
from nltk.stem import WordNetLemmatizer
from nltk.tokenize import word_tokenize
from flask import Flask
from flask import render_template, request, jsonify
from plotly.graph_objs import Bar
# from sklearn.externals import joblib
import joblib
from sqlalchemy import create_engine
app = Flask(__name__)
Am I missing something?我错过了什么吗?
Your Gunicorn argument is backwards.你的 Gunicorn 论点是倒退的。
Since your app object is called app
and it is in a file called run.py
, you should launch Gunicorn like this:由于您的应用程序 object 名为
app
并且位于名为run.py
的文件中,因此您应该像这样启动 Gunicorn:
web: gunicorn run:app
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.