我正在尝试在heroku上部署我的应用程序。我正在给出here的教程但是我一直收到这个错误:
[2016-07-19 20:12:52 +0000] [9] [ERROR] Exception in worker process
2016-07-19T20:12:52.439226+00:00 app[web.1]: Traceback (most recent call last):
2016-07-19T20:12:52.439230+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 136, in load_wsgi
2016-07-19T20:12:52.374824+00:00 app[web.1]: [2016-07-19 20:12:52 +0000] [3] [INFO] Starting gunicorn 19.6.0
2016-07-19T20:12:52.439228+00:00 app[web.1]: worker.init_process()
2016-07-19T20:12:52.439228+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 126, in init_process
2016-07-19T20:12:52.439229+00:00 app[web.1]: self.load_wsgi()
2016-07-19T20:12:52.424899+00:00 app[web.1]: [2016-07-19 20:12:52 +0000] [3] [INFO] Listening at: http://0.0.0.0:38254 (3)
2016-07-19T20:12:52.435017+00:00 app[web.1]: [2016-07-19 20:12:52 +0000] [9] [INFO] Booting worker with pid: 9
2016-07-19T20:12:52.425028+00:00 app[web.1]: [2016-07-19 20:12:52 +0000] [3] [INFO] Using worker: sync
2016-07-19T20:12:52.439227+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 557, in spawn_worker
2016-07-19T20:12:52.439248+00:00 app[web.1]: self.callable = self.load()
2016-07-19T20:12:52.450973+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2016-07-19T20:12:52.439250+00:00 app[web.1]: return self.load_wsgiapp()
2016-07-19T20:12:52.439252+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/util.py", line 361, in import_app
2016-07-19T20:12:52.450970+00:00 app[web.1]: worker.init_process()
2016-07-19T20:12:52.439249+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
2016-07-19T20:12:52.439231+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2016-07-19T20:12:52.439254+00:00 app[web.1]: ImportError: Failed to find application, did you mean '/app/redcross/redcross/wsgi:application'?
2016-07-19T20:12:52.439248+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
2016-07-19T20:12:52.448577+00:00 app[web.1]: [2016-07-19 20:12:52 +0000] [10] [INFO] Booting worker with pid: 10
2016-07-19T20:12:52.450977+00:00 app[web.1]: return util.import_app(self.app_uri)
2016-07-19T20:12:52.450978+00:00 app[web.1]: raise ImportError(msg % (module.rsplit(".", 1)[0], obj))
2016-07-19T20:12:52.450971+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 126, in init_process
2016-07-19T20:12:52.450969+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/arbiter.py", line 557, in spawn_worker
2016-07-19T20:12:52.439251+00:00 app[web.1]: return util.import_app(self.app_uri)
2016-07-19T20:12:52.439253+00:00 app[web.1]: raise ImportError(msg % (module.rsplit(".", 1)[0], obj))
2016-07-19T20:12:52.450971+00:00 app[web.1]: self.load_wsgi()
2016-07-19T20:12:52.445788+00:00 app[web.1]: [2016-07-19 20:12:52 +0000] [9] [INFO] Worker exiting (pid: 9)
2016-07-19T20:12:52.439251+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
2016-07-19T20:12:52.450973+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
2016-07-19T20:12:52.450976+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
2016-07-19T20:12:52.450977+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/util.py", line 361, in import_app
2016-07-19T20:12:52.450958+00:00 app[web.1]: [2016-07-19 20:12:52 +0000] [10] [ERROR] Exception in worker process
2016-07-19T20:12:52.450972+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/base.py", line 136, in load_wsgi
2016-07-19T20:12:52.450975+00:00 app[web.1]: return self.load_wsgiapp()
2016-07-19T20:12:52.450979+00:00 app[web.1]: ImportError: Failed to find application, did you mean '/app/redcross/redcross/wsgi:application'?
2016-07-19T20:12:52.450968+00:00 app[web.1]: Traceback (most recent call last):
2016-07-19T20:12:52.450975+00:00 app[web.1]: File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
2016-07-19T20:12:52.708960+00:00 app[web.1]: [2016-07-19 20:12:52 +0000] [3] [INFO] Shutting down: Master
2016-07-19T20:12:52.709298+00:00 app[web.1]: [2016-07-19 20:12:52 +0000] [3] [INFO] Reason: Worker failed to boot.
2016-07-19T20:12:52.450974+00:00 app[web.1]: self.callable = self.load()
2016-07-19T20:12:52.451099+00:00 app[web.1]: [2016-07-19 20:12:52 +0000] [10] [INFO] Worker exiting (pid: 10)
2016-07-19T20:12:54.339128+00:00 heroku[web.1]: Process exited with status 3
2016-07-19T20:12:54.359632+00:00 heroku[web.1]: State changed from starting to crashed
Procfile:
web: python manage.py runserver
web: gunicorn $WSGI_PATH:application --log-file -
heroku ps:scale web=1
我的目录结构:
我的procfile与requirements.txt一起位于最外层目录中,而wsgi.py位于outermost_folder/app_name/app_name/wsgi.py
答案 0 :(得分:0)
通过使用--pythonpath
web: python manage.py runserver
web: gunicorn --pythonpath path_wsgi_application --log-file -
heroku ps:scale web=1