python – 运行“heroku local”时工作进程中的异常

python – 运行“heroku local”时工作进程中的异常,第1张

概述我最近收购了一个项目,我正在使用heroku构建.我想在本地运行它,但是我遇到了麻烦,而且我对Heroku没有多少经验.这是我尝试在本地运行heroku时得到的. Mac终端命令 kaMacintosh:zddev ka$heroku localforego | starting web.1 on port 5000web.1 | [2015-12-26 15:12:43 -0500] [1 我最近收购了一个项目,我正在使用heroku构建.我想在本地运行它,但是我遇到了麻烦,而且我对Heroku没有多少经验.这是我尝试在本地运行heroku时得到的.

Mac终端命令

kaMacintosh:zddev ka$heroku localforego | starting web.1 on port 5000web.1  | [2015-12-26 15:12:43 -0500] [1741] [INFO] Starting gunicorn 19.4.1web.1  | [2015-12-26 15:12:43 -0500] [1741] [INFO] Listening at: @R_404_6822@://0.0.0.0:5000 (1741)web.1  | [2015-12-26 15:12:43 -0500] [1741] [INFO] Using worker: syncweb.1  | [2015-12-26 15:12:43 -0500] [1744] [INFO] Booting worker with pID: 1744web.1  | [2015-12-26 15:12:43 -0500] [1744] [ERROR] Exception in worker process:web.1  | zd/main.py",line 6,in <module>web.1  | ka/documents/zdenvs/zddev/main.py",in <module>web.1  | [2015-12-26 15:12:43 -0500] [1744] [INFO] Worker exiting (pID: 1744)web.1  | Traceback (most recent call last):web.1  |     sys.exit(run())web.1  |   file "/usr/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py",line 74,in runweb.1  |     super(Application,self).run()web.1  |   file "/usr/local/lib/python2.7/site-packages/gunicorn/app/base.py",line 72,in runweb.1  |     Arbiter(self).run()web.1  |   file "/usr/local/lib/python2.7/site-packages/gunicorn/arbiter.py",line 179,in runweb.1  |     self.manage_workers()web.1  |   file "/usr/local/lib/python2.7/site-packages/gunicorn/arbiter.py",line 482,in manage_workersweb.1  |     self.spawn_workers()web.1  |   file "/usr/local/lib/python2.7/site-packages/gunicorn/arbiter.py",line 549,in spawn_workersweb.1  |     time.sleep(0.1 * random.random())web.1  |   file "/usr/local/lib/python2.7/site-packages/gunicorn/arbiter.py",line 219,in handle_chldweb.1  |     self.reap_workers()web.1  |   file "/usr/local/lib/python2.7/site-packages/gunicorn/arbiter.py",line 464,in reap_workersweb.1  |     raise HaltServer(reason,self.WORKER_BOOT_ERROR)web.1  | gunicorn.errors.HaltServer: <HaltServer 'Worker Failed to boot.' 3>

procfile

web: gunicorn main:app --log-file=-

看来第6行是MysqL.connector的问题,这里是main.py的前几行

main.py

import osimport sysimport Jsonimport urllibimport customimport MysqL.connectorimport datetimeimport operatorfrom flask import Flask,Jsonifyfrom flask import render_templatefrom flask import request,redirect,url_forfrom MysqL.connector import errorcodeapplication = Flask(__name__)app = application

关于导致错误或如何解决的任何想法.它真的是MysqL.connector导致main.py中第6行的问题吗?我使用的是Python 2.7.11.

运行gunicorn主:app自己生产

Traceback (most recent call last):  file "/usr/local/lib/python2.7/site-packages/gunicorn/arbiter.py",line 515,in spawn_worker    worker.init_process()  file "/usr/local/lib/python2.7/site-packages/gunicorn/workers/base.py",line 122,in init_process    self.load_wsgi()  file "/usr/local/lib/python2.7/site-packages/gunicorn/workers/base.py",line 130,in load_wsgi    self.wsgi = self.app.wsgi()  file "/usr/local/lib/python2.7/site-packages/gunicorn/app/base.py",line 67,in wsgi    self.callable = self.load()  file "/usr/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py",line 65,in load    return self.load_wsgiapp()  file "/usr/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py",line 52,in load_wsgiapp    return util.import_app(self.app_uri)  file "/usr/local/lib/python2.7/site-packages/gunicorn/util.py",line 354,in import_app    __import__(module)  file "/Users/ka/documents/zdenvs/zddev/main.py",in <module>    import MysqL.connectorimportError: No module named MysqL.connectorTraceback (most recent call last):  file "/usr/local/lib/python2.7/site-packages/gunicorn/arbiter.py",in <module>    import MysqL.connectorimportError: No module named MysqL.connector[2016-01-04 15:34:18 -0500] [6225] [INFO] Worker exiting (pID: 6225)Traceback (most recent call last):  file "/usr/local/bin/gunicorn",line 11,in <module>    sys.exit(run())  file "/usr/local/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py",in run    WsgiApplication("%(prog)s [OPTIONS] [APP_MODulE]").run()  file "/usr/local/lib/python2.7/site-packages/gunicorn/app/base.py",line 192,in run    super(Application,self).run()  file "/usr/local/lib/python2.7/site-packages/gunicorn/app/base.py",in run    Arbiter(self).run()  file "/usr/local/lib/python2.7/site-packages/gunicorn/arbiter.py",in run    self.manage_workers()  file "/usr/local/lib/python2.7/site-packages/gunicorn/arbiter.py",in manage_workers    self.spawn_workers()  file "/usr/local/lib/python2.7/site-packages/gunicorn/arbiter.py",in spawn_workers    time.sleep(0.1 * random.random())  file "/usr/local/lib/python2.7/site-packages/gunicorn/arbiter.py",in handle_chld    self.reap_workers()  file "/usr/local/lib/python2.7/site-packages/gunicorn/arbiter.py",in reap_workers    raise HaltServer(reason,self.WORKER_BOOT_ERROR)gunicorn.errors.HaltServer: <HaltServer 'Worker Failed to boot.' 3>
解决方法 尝试手动运行

“python manage.py runserver 0.0.0.0:5000”

总结

以上是内存溢出为你收集整理的python – 运行“heroku local”时工作进程中的异常全部内容,希望文章能够帮你解决python – 运行“heroku local”时工作进程中的异常所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/1196036.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-03
下一篇 2022-06-03

发表评论

登录后才能评论

评论列表(0条)

保存