Heroku 部署:ModuleNotFoundError:没有名为“django_summernote”的模块
Posted
技术标签:
【中文标题】Heroku 部署:ModuleNotFoundError:没有名为“django_summernote”的模块【英文标题】:Heroku Deployment : ModuleNotFoundError: No module named 'django_summernote' 【发布时间】:2019-05-11 10:23:09 【问题描述】:在我的 python django 博客应用程序部署期间,这种情况不断发生!所以我不知道如何处理它了。其实我发现了卡住的错误ModuleNotFoundError: No module named 'django_summernote'
。
我解决了许多以前的错误,h10,h14,但ModuleNotFoundError
仍然存在。
在我setting.py
的已安装应用程序中,它没有任何问题。
所以我赶不上..
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'articles',
'templates',
'django_summernote',
'sorl.thumbnail',
'gunicorn',
]
以下是错误部分
State changed from crashed to starting
2018-12-10T13:25:48.417441+00:00 heroku[web.1]: Starting process with command `gunicorn djangoblog.wsgi:application --log-file - --log-level debug`
2018-12-10T13:25:48.000000+00:00 app[api]: Build succeeded
2018-12-10T13:25:51.553811+00:00 app[web.1]: [2018-12-10 13:25:51 +0000] [4] [DEBUG] Current configuration:
2018-12-10T13:25:51.553836+00:00 app[web.1]: config: None
2018-12-10T13:25:51.553838+00:00 app[web.1]: bind: ['0.0.0.0:47277']
2018-12-10T13:25:51.553839+00:00 app[web.1]: backlog: 2048
2018-12-10T13:25:51.553841+00:00 app[web.1]: workers: 2
2018-12-10T13:25:51.553842+00:00 app[web.1]: worker_class: sync
2018-12-10T13:25:51.553844+00:00 app[web.1]: threads: 1
2018-12-10T13:25:51.553845+00:00 app[web.1]: worker_connections: 1000
2018-12-10T13:25:51.553847+00:00 app[web.1]: max_requests: 0
2018-12-10T13:25:51.553848+00:00 app[web.1]: max_requests_jitter: 0
2018-12-10T13:25:51.553850+00:00 app[web.1]: timeout: 30
2018-12-10T13:25:51.553851+00:00 app[web.1]: graceful_timeout: 30
2018-12-10T13:25:51.553852+00:00 app[web.1]: keepalive: 2
2018-12-10T13:25:51.553854+00:00 app[web.1]: limit_request_line: 4094
2018-12-10T13:25:51.553855+00:00 app[web.1]: limit_request_fields: 100
2018-12-10T13:25:51.553857+00:00 app[web.1]: limit_request_field_size: 8190
2018-12-10T13:25:51.553858+00:00 app[web.1]: reload: False
2018-12-10T13:25:51.553859+00:00 app[web.1]: reload_engine: auto
2018-12-10T13:25:51.553861+00:00 app[web.1]: reload_extra_files: []
2018-12-10T13:25:51.553862+00:00 app[web.1]: spew: False
2018-12-10T13:25:51.553864+00:00 app[web.1]: check_config: False
2018-12-10T13:25:51.553865+00:00 app[web.1]: preload_app: False
2018-12-10T13:25:51.553866+00:00 app[web.1]: sendfile: None
2018-12-10T13:25:51.553868+00:00 app[web.1]: reuse_port: False
2018-12-10T13:25:51.553869+00:00 app[web.1]: chdir: /app
2018-12-10T13:25:51.553871+00:00 app[web.1]: daemon: False
2018-12-10T13:25:51.553872+00:00 app[web.1]: raw_env: []
2018-12-10T13:25:51.553873+00:00 app[web.1]: pidfile: None
2018-12-10T13:25:51.553875+00:00 app[web.1]: worker_tmp_dir: None
2018-12-10T13:25:51.553876+00:00 app[web.1]: user: 50242
2018-12-10T13:25:51.553878+00:00 app[web.1]: group: 50242
2018-12-10T13:25:51.553879+00:00 app[web.1]: umask: 0
2018-12-10T13:25:51.553880+00:00 app[web.1]: initgroups: False
2018-12-10T13:25:51.553882+00:00 app[web.1]: tmp_upload_dir: None
2018-12-10T13:25:51.553900+00:00 app[web.1]: secure_scheme_headers: 'X-FORWARDED-PROTOCOL': 'ssl', 'X-FORWARDED-PROTO': 'https', 'X-FORWARDED-SSL': 'on'
2018-12-10T13:25:51.553902+00:00 app[web.1]: forwarded_allow_ips: ['*']
2018-12-10T13:25:51.553904+00:00 app[web.1]: accesslog: -
2018-12-10T13:25:51.553905+00:00 app[web.1]: disable_redirect_access_to_syslog: False
2018-12-10T13:25:51.553907+00:00 app[web.1]: access_log_format: %(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s"
2018-12-10T13:25:51.553908+00:00 app[web.1]: errorlog: -
2018-12-10T13:25:51.553909+00:00 app[web.1]: loglevel: debug
2018-12-10T13:25:51.553911+00:00 app[web.1]: capture_output: False
2018-12-10T13:25:51.553912+00:00 app[web.1]: logger_class: gunicorn.glogging.Logger
2018-12-10T13:25:51.553914+00:00 app[web.1]: logconfig: None
2018-12-10T13:25:51.553915+00:00 app[web.1]: logconfig_dict:
2018-12-10T13:25:51.553917+00:00 app[web.1]: syslog_addr: udp://localhost:514
2018-12-10T13:25:51.553918+00:00 app[web.1]: syslog: False
2018-12-10T13:25:51.553919+00:00 app[web.1]: syslog_prefix: None
2018-12-10T13:25:51.553921+00:00 app[web.1]: syslog_facility: user
2018-12-10T13:25:51.553923+00:00 app[web.1]: enable_stdio_inheritance: False
2018-12-10T13:25:51.553924+00:00 app[web.1]: statsd_host: None
2018-12-10T13:25:51.553925+00:00 app[web.1]: statsd_prefix:
2018-12-10T13:25:51.553927+00:00 app[web.1]: proc_name: None
2018-12-10T13:25:51.553928+00:00 app[web.1]: default_proc_name: djangoblog.wsgi:application
2018-12-10T13:25:51.553930+00:00 app[web.1]: pythonpath: None
2018-12-10T13:25:51.553931+00:00 app[web.1]: paste: None
2018-12-10T13:25:51.553933+00:00 app[web.1]: on_starting: <function OnStarting.on_starting at 0x7facbfe22268>
2018-12-10T13:25:51.553934+00:00 app[web.1]: on_reload: <function OnReload.on_reload at 0x7facbfe22378>
2018-12-10T13:25:51.553936+00:00 app[web.1]: when_ready: <function WhenReady.when_ready at 0x7facbfe22488>
2018-12-10T13:25:51.553937+00:00 app[web.1]: pre_fork: <function Prefork.pre_fork at 0x7facbfe22598>
2018-12-10T13:25:51.553939+00:00 app[web.1]: post_fork: <function Postfork.post_fork at 0x7facbfe226a8>
2018-12-10T13:25:51.553940+00:00 app[web.1]: post_worker_init: <function PostWorkerInit.post_worker_init at 0x7facbfe227b8>
2018-12-10T13:25:51.553942+00:00 app[web.1]: worker_int: <function WorkerInt.worker_int at 0x7facbfe228c8>
2018-12-10T13:25:51.553943+00:00 app[web.1]: worker_abort: <function WorkerAbort.worker_abort at 0x7facbfe229d8>
2018-12-10T13:25:51.553945+00:00 app[web.1]: pre_exec: <function PreExec.pre_exec at 0x7facbfe22ae8>
2018-12-10T13:25:51.553946+00:00 app[web.1]: pre_request: <function PreRequest.pre_request at 0x7facbfe22bf8>
2018-12-10T13:25:51.553948+00:00 app[web.1]: post_request: <function PostRequest.post_request at 0x7facbfe22c80>
2018-12-10T13:25:51.553949+00:00 app[web.1]: child_exit: <function ChildExit.child_exit at 0x7facbfe22d90>
2018-12-10T13:25:51.553950+00:00 app[web.1]: worker_exit: <function WorkerExit.worker_exit at 0x7facbfe22ea0>
2018-12-10T13:25:51.553952+00:00 app[web.1]: nworkers_changed: <function NumWorkersChanged.nworkers_changed at 0x7facbfe2f048>
2018-12-10T13:25:51.553953+00:00 app[web.1]: on_exit: <function OnExit.on_exit at 0x7facbfe2f158>
2018-12-10T13:25:51.553955+00:00 app[web.1]: proxy_protocol: False
2018-12-10T13:25:51.553956+00:00 app[web.1]: proxy_allow_ips: ['127.0.0.1']
2018-12-10T13:25:51.553958+00:00 app[web.1]: keyfile: None
2018-12-10T13:25:51.553959+00:00 app[web.1]: certfile: None
2018-12-10T13:25:51.553961+00:00 app[web.1]: ssl_version: 2
2018-12-10T13:25:51.553962+00:00 app[web.1]: cert_reqs: 0
2018-12-10T13:25:51.553963+00:00 app[web.1]: ca_certs: None
2018-12-10T13:25:51.553965+00:00 app[web.1]: suppress_ragged_eofs: True
2018-12-10T13:25:51.553966+00:00 app[web.1]: do_handshake_on_connect: False
2018-12-10T13:25:51.553968+00:00 app[web.1]: ciphers: TLSv1
2018-12-10T13:25:51.553977+00:00 app[web.1]: raw_paste_global_conf: []
2018-12-10T13:25:51.554464+00:00 app[web.1]: [2018-12-10 13:25:51 +0000] [4] [INFO] Starting gunicorn 19.9.0
2018-12-10T13:25:51.560899+00:00 app[web.1]: [2018-12-10 13:25:51 +0000] [4] [DEBUG] Arbiter booted
2018-12-10T13:25:51.561173+00:00 app[web.1]: [2018-12-10 13:25:51 +0000] [4] [INFO] Listening at: http://0.0.0.0:47277 (4)
2018-12-10T13:25:51.561349+00:00 app[web.1]: [2018-12-10 13:25:51 +0000] [4] [INFO] Using worker: sync
2018-12-10T13:25:51.570108+00:00 app[web.1]: [2018-12-10 13:25:51 +0000] [10] [INFO] Booting worker with pid: 10
2018-12-10T13:25:51.610234+00:00 app[web.1]: [2018-12-10 13:25:51 +0000] [11] [INFO] Booting worker with pid: 11
2018-12-10T13:25:51.704389+00:00 app[web.1]: [2018-12-10 13:25:51 +0000] [4] [DEBUG] 2 workers
2018-12-10T13:25:52.856398+00:00 app[web.1]: [2018-12-10 22:25:52 +0900] [10] [ERROR] Exception in worker process
2018-12-10T13:25:52.856447+00:00 app[web.1]: Traceback (most recent call last):
2018-12-10T13:25:52.856450+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
2018-12-10T13:25:52.856452+00:00 app[web.1]: worker.init_process()
2018-12-10T13:25:52.856453+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 129, in init_process
2018-12-10T13:25:52.856455+00:00 app[web.1]: self.load_wsgi()
2018-12-10T13:25:52.856456+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 138, in load_wsgi
2018-12-10T13:25:52.856458+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2018-12-10T13:25:52.856459+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 67, in wsgi
2018-12-10T13:25:52.856461+00:00 app[web.1]: self.callable = self.load()
2018-12-10T13:25:52.856463+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 52, in load
2018-12-10T13:25:52.856464+00:00 app[web.1]: return self.load_wsgiapp()
2018-12-10T13:25:52.856466+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
2018-12-10T13:25:52.856467+00:00 app[web.1]: return util.import_app(self.app_uri)
2018-12-10T13:25:52.856469+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/util.py", line 350, in import_app
2018-12-10T13:25:52.856470+00:00 app[web.1]: __import__(module)
2018-12-10T13:25:52.856473+00:00 app[web.1]: File "/app/djangoblog/wsgi.py", line 16, in <module>
2018-12-10T13:25:52.856474+00:00 app[web.1]: application = get_wsgi_application()
2018-12-10T13:25:52.856476+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
2018-12-10T13:25:52.856477+00:00 app[web.1]: django.setup(set_prefix=False)
2018-12-10T13:25:52.856479+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/__init__.py", line 24, in setup
2018-12-10T13:25:52.856480+00:00 app[web.1]: apps.populate(settings.INSTALLED_APPS)
2018-12-10T13:25:52.856482+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/apps/registry.py", line 89, in populate
2018-12-10T13:25:52.856483+00:00 app[web.1]: app_config = AppConfig.create(entry)
2018-12-10T13:25:52.856485+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/apps/config.py", line 90, in create
2018-12-10T13:25:52.856486+00:00 app[web.1]: module = import_module(entry)
2018-12-10T13:25:52.856488+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/importlib/__init__.py", line 126, in import_module
2018-12-10T13:25:52.856489+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2018-12-10T13:25:52.856497+00:00 app[web.1]: ModuleNotFoundError: No module named 'django_summernote'
2018-12-10T13:25:52.856514+00:00 app[web.1]: [2018-12-10 22:25:52 +0900] [11] [ERROR] Exception in worker process
2018-12-10T13:25:52.856516+00:00 app[web.1]: Traceback (most recent call last):
2018-12-10T13:25:52.856517+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
2018-12-10T13:25:52.856519+00:00 app[web.1]: worker.init_process()
2018-12-10T13:25:52.856521+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 129, in init_process
2018-12-10T13:25:52.856522+00:00 app[web.1]: self.load_wsgi()
2018-12-10T13:25:52.856524+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py", line 138, in load_wsgi
2018-12-10T13:25:52.856525+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2018-12-10T13:25:52.856527+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py", line 67, in wsgi
2018-12-10T13:25:52.856528+00:00 app[web.1]: self.callable = self.load()
2018-12-10T13:25:52.856529+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 52, in load
2018-12-10T13:25:52.856531+00:00 app[web.1]: return self.load_wsgiapp()
2018-12-10T13:25:52.856532+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp
2018-12-10T13:25:52.856534+00:00 app[web.1]: return util.import_app(self.app_uri)
2018-12-10T13:25:52.856535+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/gunicorn/util.py", line 350, in import_app
2018-12-10T13:25:52.856536+00:00 app[web.1]: __import__(module)
2018-12-10T13:25:52.856538+00:00 app[web.1]: File "/app/djangoblog/wsgi.py", line 16, in <module>
2018-12-10T13:25:52.856539+00:00 app[web.1]: application = get_wsgi_application()
2018-12-10T13:25:52.856541+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application
2018-12-10T13:25:52.856542+00:00 app[web.1]: django.setup(set_prefix=False)
2018-12-10T13:25:52.856544+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/__init__.py", line 24, in setup
2018-12-10T13:25:52.856545+00:00 app[web.1]: apps.populate(settings.INSTALLED_APPS)
2018-12-10T13:25:52.856546+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/apps/registry.py", line 89, in populate
2018-12-10T13:25:52.856548+00:00 app[web.1]: app_config = AppConfig.create(entry)
2018-12-10T13:25:52.856549+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/django/apps/config.py", line 90, in create
2018-12-10T13:25:52.856551+00:00 app[web.1]: module = import_module(entry)
2018-12-10T13:25:52.856552+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/importlib/__init__.py", line 126, in import_module
2018-12-10T13:25:52.856553+00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2018-12-10T13:25:52.856590+00:00 app[web.1]: ModuleNotFoundError: No module named 'django_summernote'
2018-12-10T13:25:52.856988+00:00 app[web.1]: [2018-12-10 22:25:52 +0900] [10] [INFO] Worker exiting (pid: 10)
2018-12-10T13:25:52.857183+00:00 app[web.1]: [2018-12-10 22:25:52 +0900] [11] [INFO] Worker exiting (pid: 11)
2018-12-10T13:25:53.034230+00:00 app[web.1]: [2018-12-10 13:25:53 +0000] [4] [INFO] Shutting down: Master
2018-12-10T13:25:53.034673+00:00 app[web.1]: [2018-12-10 13:25:53 +0000] [4] [INFO] Reason: Worker failed to boot.
2018-12-10T13:25:52.898067+00:00 heroku[web.1]: State changed from starting to up
2018-12-10T13:25:53.175315+00:00 heroku[web.1]: Process exited with status 3
2018-12-10T13:25:53.196695+00:00 heroku[web.1]: State changed from up to crashed
过程文件
web: gunicorn djangoblog.wsgi:application --log-file - --log-level debug
【问题讨论】:
确保django-summernote
在您的requirements.txt
/pipenv
文件中,并且您已签入最新版本。
谢谢阿拉斯代尔。然后py -m pip freeze > requirements.txt
之后,通过Git,完美运行!
【参考方案1】:
只有在 urls.py 文件中声明了路径但没有在 views.py 文件中声明函数时才会出现这种类型的错误。确保您已按照以下步骤操作: 1.在setting.py文件中注册你的应用 2. urls.py 文件中声明的路径(在项目目录中) 3. urls.py 文件中声明的路径(在您的应用程序目录中) 4.在views.py文件中声明def(函数)
【讨论】:
以上是关于Heroku 部署:ModuleNotFoundError:没有名为“django_summernote”的模块的主要内容,如果未能解决你的问题,请参考以下文章
MERN 应用程序在部署到 Heroku 时无法运行“heroku-postbuild”脚本
Heroku/Django 部署:为啥我在成功部署和静态收集时收到错误 500?
如何更新使用 GitHub“部署到 Heroku”按钮创建的 Heroku 应用程序?