无法部署Django + Heroku at =错误代码= H10 desc =“应用程序崩溃”,方法= GET path =“ / favicon.ico”

如何解决无法部署Django + Heroku at =错误代码= H10 desc =“应用程序崩溃”,方法= GET path =“ / favicon.ico”

我在将第一个Django应用程序部署到Heroku时遇到问题。它在开发中效果很好,但我无法在日志中找到(或理解)该问题。我检查了多个具有相同H10错误的线程,但每个人似乎都有某种不同的日志,而他们的解决方案在我这一端不起作用。让我知道,除了以下内容之外,我是否还需要包含其他内容,以便了解发生了什么事情。

完整日志:

2020-08-11T08:36:47.390320+00:00 app[web.1]: self.callable = self.load()
2020-08-11T08:36:47.390320+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py",line 49,in load
2020-08-11T08:36:47.390321+00:00 app[web.1]: return self.load_wsgiapp()
2020-08-11T08:36:47.390321+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py",line 39,in load_wsgiapp
2020-08-11T08:36:47.390321+00:00 app[web.1]: return util.import_app(self.app_uri)
2020-08-11T08:36:47.390321+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/util.py",line 358,in import_app
2020-08-11T08:36:47.390322+00:00 app[web.1]: mod = importlib.import_module(module)
2020-08-11T08:36:47.390322+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/importlib/__init__.py",line 126,in import_module
2020-08-11T08:36:47.390322+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:],package,level)
2020-08-11T08:36:47.390323+00:00 app[web.1]: File "<frozen importlib._bootstrap>",line 994,in _gcd_import
2020-08-11T08:36:47.390323+00:00 app[web.1]: File "<frozen importlib._bootstrap>",line 971,in _find_and_load
2020-08-11T08:36:47.390323+00:00 app[web.1]: File "<frozen importlib._bootstrap>",line 941,in _find_and_load_unlocked
2020-08-11T08:36:47.390324+00:00 app[web.1]: File "<frozen importlib._bootstrap>",line 219,in _call_with_frames_removed
2020-08-11T08:36:47.390324+00:00 app[web.1]: File "<frozen importlib._bootstrap>",in _gcd_import
2020-08-11T08:36:47.390324+00:00 app[web.1]: File "<frozen importlib._bootstrap>",in _find_and_load
2020-08-11T08:36:47.390325+00:00 app[web.1]: File "<frozen importlib._bootstrap>",line 953,in _find_and_load_unlocked
2020-08-11T08:36:47.390333+00:00 app[web.1]: ModuleNotFoundError: No module named 'craigslist_clone'
2020-08-11T08:36:47.390551+00:00 app[web.1]: [2020-08-11 08:36:47 +0000] [10] [INFO] Worker exiting (pid: 10)
2020-08-11T08:36:47.442506+00:00 app[web.1]: [2020-08-11 08:36:47 +0000] [4] [INFO] Shutting down: Master
2020-08-11T08:36:47.442581+00:00 app[web.1]: [2020-08-11 08:36:47 +0000] [4] [INFO] Reason: Worker failed to boot.
2020-08-11T08:36:47.540045+00:00 heroku[web.1]: Process exited with status 3
2020-08-11T08:36:47.589027+00:00 heroku[web.1]: State changed from starting to crashed
2020-08-11T08:36:47.591726+00:00 heroku[web.1]: State changed from crashed to starting
2020-08-11T08:36:52.986845+00:00 heroku[web.1]: Starting process with command `gunicorn craigslist_clone.wsgi`
2020-08-11T08:36:54.949245+00:00 app[web.1]: [2020-08-11 08:36:54 +0000] [4] [INFO] Starting gunicorn 20.0.4
2020-08-11T08:36:54.949773+00:00 app[web.1]: [2020-08-11 08:36:54 +0000] [4] [INFO] Listening at: http://0.0.0.0:44861 (4)
2020-08-11T08:36:54.949871+00:00 app[web.1]: [2020-08-11 08:36:54 +0000] [4] [INFO] Using worker: sync
2020-08-11T08:36:54.954399+00:00 app[web.1]: [2020-08-11 08:36:54 +0000] [10] [INFO] Booting worker with pid: 10
2020-08-11T08:36:54.960530+00:00 app[web.1]: [2020-08-11 08:36:54 +0000] [10] [ERROR] Exception in worker process
2020-08-11T08:36:54.960531+00:00 app[web.1]: Traceback (most recent call last):
2020-08-11T08:36:54.960531+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py",line 583,in spawn_worker
2020-08-11T08:36:54.960531+00:00 app[web.1]: worker.init_process()
2020-08-11T08:36:54.960532+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py",line 119,in init_process
2020-08-11T08:36:54.960532+00:00 app[web.1]: self.load_wsgi()
2020-08-11T08:36:54.960532+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py",line 144,in load_wsgi
2020-08-11T08:36:54.960532+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2020-08-11T08:36:54.960533+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py",line 67,in wsgi
2020-08-11T08:36:54.960533+00:00 app[web.1]: self.callable = self.load()
2020-08-11T08:36:54.960533+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py",in load
2020-08-11T08:36:54.960533+00:00 app[web.1]: return self.load_wsgiapp()
2020-08-11T08:36:54.960534+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py",in load_wsgiapp
2020-08-11T08:36:54.960534+00:00 app[web.1]: return util.import_app(self.app_uri)
2020-08-11T08:36:54.960534+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/util.py",in import_app
2020-08-11T08:36:54.960534+00:00 app[web.1]: mod = importlib.import_module(module)
2020-08-11T08:36:54.960534+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/importlib/__init__.py",in import_module
2020-08-11T08:36:54.960535+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:],level)
2020-08-11T08:36:54.960535+00:00 app[web.1]: File "<frozen importlib._bootstrap>",in _gcd_import
2020-08-11T08:36:54.960535+00:00 app[web.1]: File "<frozen importlib._bootstrap>",in _find_and_load
2020-08-11T08:36:54.960535+00:00 app[web.1]: File "<frozen importlib._bootstrap>",in _find_and_load_unlocked
2020-08-11T08:36:54.960536+00:00 app[web.1]: File "<frozen importlib._bootstrap>",in _call_with_frames_removed
2020-08-11T08:36:54.960536+00:00 app[web.1]: File "<frozen importlib._bootstrap>",in _gcd_import
2020-08-11T08:36:54.960536+00:00 app[web.1]: File "<frozen importlib._bootstrap>",in _find_and_load
2020-08-11T08:36:54.960536+00:00 app[web.1]: File "<frozen importlib._bootstrap>",in _find_and_load_unlocked
2020-08-11T08:36:54.960540+00:00 app[web.1]: ModuleNotFoundError: No module named 'craigslist_clone'
2020-08-11T08:36:54.960717+00:00 app[web.1]: [2020-08-11 08:36:54 +0000] [10] [INFO] Worker exiting (pid: 10)
2020-08-11T08:36:54.981960+00:00 app[web.1]: [2020-08-11 08:36:54 +0000] [11] [INFO] Booting worker with pid: 11
2020-08-11T08:36:54.987590+00:00 app[web.1]: [2020-08-11 08:36:54 +0000] [11] [ERROR] Exception in worker process
2020-08-11T08:36:54.987592+00:00 app[web.1]: Traceback (most recent call last):
2020-08-11T08:36:54.987592+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py",in spawn_worker
2020-08-11T08:36:54.987593+00:00 app[web.1]: worker.init_process()
2020-08-11T08:36:54.987593+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py",in init_process
2020-08-11T08:36:54.987594+00:00 app[web.1]: self.load_wsgi()
2020-08-11T08:36:54.987594+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py",in load_wsgi
2020-08-11T08:36:54.987594+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2020-08-11T08:36:54.987595+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py",in wsgi
2020-08-11T08:36:54.987595+00:00 app[web.1]: self.callable = self.load()
2020-08-11T08:36:54.987600+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py",in load
2020-08-11T08:36:54.987600+00:00 app[web.1]: return self.load_wsgiapp()
2020-08-11T08:36:54.987600+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py",in load_wsgiapp
2020-08-11T08:36:54.987601+00:00 app[web.1]: return util.import_app(self.app_uri)
2020-08-11T08:36:54.987601+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/util.py",in import_app
2020-08-11T08:36:54.987602+00:00 app[web.1]: mod = importlib.import_module(module)
2020-08-11T08:36:54.987602+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/importlib/__init__.py",in import_module
2020-08-11T08:36:54.987602+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:],level)
2020-08-11T08:36:54.987603+00:00 app[web.1]: File "<frozen importlib._bootstrap>",in _gcd_import
2020-08-11T08:36:54.987603+00:00 app[web.1]: File "<frozen importlib._bootstrap>",in _find_and_load
2020-08-11T08:36:54.987604+00:00 app[web.1]: File "<frozen importlib._bootstrap>",in _find_and_load_unlocked
2020-08-11T08:36:54.987604+00:00 app[web.1]: File "<frozen importlib._bootstrap>",in _call_with_frames_removed
2020-08-11T08:36:54.987605+00:00 app[web.1]: File "<frozen importlib._bootstrap>",in _gcd_import
2020-08-11T08:36:54.987605+00:00 app[web.1]: File "<frozen importlib._bootstrap>",in _find_and_load
2020-08-11T08:36:54.987605+00:00 app[web.1]: File "<frozen importlib._bootstrap>",in _find_and_load_unlocked
2020-08-11T08:36:54.987611+00:00 app[web.1]: ModuleNotFoundError: No module named 'craigslist_clone'
2020-08-11T08:36:54.987736+00:00 app[web.1]: [2020-08-11 08:36:54 +0000] [11] [INFO] Worker exiting (pid: 11)
2020-08-11T08:36:55.000000+00:00 app[api]: Build succeeded
2020-08-11T08:36:55.093662+00:00 app[web.1]: [2020-08-11 08:36:55 +0000] [4] [INFO] Shutting down: Master
2020-08-11T08:36:55.093752+00:00 app[web.1]: [2020-08-11 08:36:55 +0000] [4] [INFO] Reason: Worker failed to boot.
2020-08-11T08:36:55.157659+00:00 heroku[web.1]: Process exited with status 3
2020-08-11T08:36:55.193966+00:00 heroku[web.1]: State changed from starting to crashed
2020-08-11T08:37:07.657451+00:00 app[api]: Starting process with command `python manage.py migrate` by user mwoonky@gmail.com
2020-08-11T08:37:13.678634+00:00 heroku[run.6426]: State changed from starting to up
2020-08-11T08:37:13.774667+00:00 heroku[run.6426]: Awaiting client
2020-08-11T08:37:13.797319+00:00 heroku[run.6426]: Starting process with command `python manage.py migrate`
2020-08-11T08:37:20.153983+00:00 heroku[run.6426]: Process exited with status 0
2020-08-11T08:37:20.189249+00:00 heroku[run.6426]: State changed from up to complete
2020-08-11T08:37:26.966717+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=gentle-journey-70264.herokuapp.com request_id=f71ce6d3-dd74-4a25-8468-289bcda1f39f fwd="145.101.22.108" dyno= connect= service= status=503 bytes= protocol=https
2020-08-11T08:37:28.566366+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=gentle-journey-70264.herokuapp.com request_id=dda4b09d-62cd-4cce-a613-181aa9a49d00 fwd="145.101.22.108" dyno= connect= service= status=503 bytes= protocol=https
2020-08-11T08:38:20.797118+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=gentle-journey-70264.herokuapp.com request_id=9fe9cfbe-ee30-41fe-83c8-34ce82b577b6 fwd="145.101.22.108" dyno= connect= service= status=503 bytes= protocol=https
2020-08-11T08:38:22.379610+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=gentle-journey-70264.herokuapp.com request_id=b6ab19f3-131b-451f-83f0-a4f7149b39a6 fwd="145.101.22.108" dyno= connect= service= status=503 bytes= protocol=https
2020-08-11T08:39:14.019669+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=gentle-journey-70264.herokuapp.com request_id=f75b7237-4cef-4546-ada6-4c604be042eb fwd="145.101.22.108" dyno= connect= service= status=503 bytes= protocol=https
2020-08-11T08:39:15.505950+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=gentle-journey-70264.herokuapp.com request_id=3e03d12f-8b60-4777-85fb-4a67fe3ccc4a fwd="145.101.22.108" dyno= connect= service= status=503 bytes= protocol=https

Procfile

web: gunicorn craigslist_clone.wsgi

这是我的要求。txt

appdirs==1.4.4
asgiref==3.2.10
beautifulsoup4==4.9.1
bs4==0.0.1
certifi==2020.6.20
chardet==3.0.4
distlib==0.3.1
dj-database-url==0.5.0
Django==3.1
django-heroku==0.3.1
filelock==3.0.12
gunicorn==20.0.4
heroku==0.1.4
idna==2.10
pipenv==2020.6.2
psycopg2==2.8.5
psycopg2-binary==2.8.5
python-dateutil==1.5
pytz==2020.1
requests==2.24.0
six==1.15.0
soupsieve==2.0.1
sqlparse==0.3.1
urllib3==1.25.10
virtualenv==20.0.30
virtualenv-clone==0.5.4
whitenoise==5.2.0

Settings.py还包括以下内容:

import django_heroku
django_heroku.settings(locals())

解决方法

ModuleNotFoundError:没有名为“ craigslist_clone”的模块

如果craigslist_clone是您的本地函数,请检查函数调用,或者如果craigslist_clone是全局python函数,则找不到craigslist_clone

如果共享代码文件存在问题

,

错误:发生什么错误表示没有模块'craigslist_clone'

正如您提到的,它在开发中效果很好,并且在部署中发生错误。因此错误不是来自任何python函数。

我建议您在requirements.txt文件中指定显式依赖项版本。要更新此文件,可以在活动的虚拟环境(开发)中使用pip freeze命令:

$ pip freeze > requirements.txt

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


依赖报错 idea导入项目后依赖报错,解决方案:https://blog.csdn.net/weixin_42420249/article/details/81191861 依赖版本报错:更换其他版本 无法下载依赖可参考:https://blog.csdn.net/weixin_42628809/a
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下 2021-12-03 13:33:33.927 ERROR 7228 [ main] o.s.b.d.LoggingFailureAnalysisReporter : *************************** APPL
错误1:gradle项目控制台输出为乱码 # 解决方案:https://blog.csdn.net/weixin_43501566/article/details/112482302 # 在gradle-wrapper.properties 添加以下内容 org.gradle.jvmargs=-Df
错误还原:在查询的过程中,传入的workType为0时,该条件不起作用 &lt;select id=&quot;xxx&quot;&gt; SELECT di.id, di.name, di.work_type, di.updated... &lt;where&gt; &lt;if test=&qu
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct redisServer’没有名为‘server_cpulist’的成员 redisSetCpuAffinity(server.server_cpulist); ^ server.c: 在函数‘hasActiveC
解决方案1 1、改项目中.idea/workspace.xml配置文件,增加dynamic.classpath参数 2、搜索PropertiesComponent,添加如下 &lt;property name=&quot;dynamic.classpath&quot; value=&quot;tru
删除根组件app.vue中的默认代码后报错:Module Error (from ./node_modules/eslint-loader/index.js): 解决方案:关闭ESlint代码检测,在项目根目录创建vue.config.js,在文件中添加 module.exports = { lin
查看spark默认的python版本 [root@master day27]# pyspark /home/software/spark-2.3.4-bin-hadoop2.7/conf/spark-env.sh: line 2: /usr/local/hadoop/bin/hadoop: No s
使用本地python环境可以成功执行 import pandas as pd import matplotlib.pyplot as plt # 设置字体 plt.rcParams[&#39;font.sans-serif&#39;] = [&#39;SimHei&#39;] # 能正确显示负号 p
错误1:Request method ‘DELETE‘ not supported 错误还原:controller层有一个接口,访问该接口时报错:Request method ‘DELETE‘ not supported 错误原因:没有接收到前端传入的参数,修改为如下 参考 错误2:cannot r
错误1:启动docker镜像时报错:Error response from daemon: driver failed programming external connectivity on endpoint quirky_allen 解决方法:重启docker -&gt; systemctl r
错误1:private field ‘xxx‘ is never assigned 按Altʾnter快捷键,选择第2项 参考:https://blog.csdn.net/shi_hong_fei_hei/article/details/88814070 错误2:启动时报错,不能找到主启动类 #
报错如下,通过源不能下载,最后警告pip需升级版本 Requirement already satisfied: pip in c:\users\ychen\appdata\local\programs\python\python310\lib\site-packages (22.0.4) Coll
错误1:maven打包报错 错误还原:使用maven打包项目时报错如下 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources)
错误1:服务调用时报错 服务消费者模块assess通过openFeign调用服务提供者模块hires 如下为服务提供者模块hires的控制层接口 @RestController @RequestMapping(&quot;/hires&quot;) public class FeignControl
错误1:运行项目后报如下错误 解决方案 报错2:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project sb 解决方案:在pom.
参考 错误原因 过滤器或拦截器在生效时,redisTemplate还没有注入 解决方案:在注入容器时就生效 @Component //项目运行时就注入Spring容器 public class RedisBean { @Resource private RedisTemplate&lt;String
使用vite构建项目报错 C:\Users\ychen\work&gt;npm init @vitejs/app @vitejs/create-app is deprecated, use npm init vite instead C:\Users\ychen\AppData\Local\npm-