我尝试按照https://devcenter.heroku.com/articles/heroku-local上的教程使用heroku命令行工具 它以退出代码3退出。
$ heroku local
[OKAY] Loaded ENV .env File as KEY=VALUE Format
01:53:43 web.1 | [2017-12-30 01:53:43 +0000] [13114] [INFO] Starting gunicorn 19.4.5
01:53:43 web.1 | [2017-12-30 01:53:43 +0000] [13114] [INFO] Listening at: http://0.0.0.0:5000 (13114)
01:53:43 web.1 | [2017-12-30 01:53:43 +0000] [13114] [INFO] Using worker: sync
01:53:43 web.1 | [2017-12-30 01:53:43 +0000] [13119] [INFO] Booting worker with pid: 13119
01:53:43 web.1 | [2017-12-30 01:53:43 +0000] [13119] [ERROR] Exception in worker process:
01:53:43 web.1 | Traceback (most recent call last):
01:53:43 web.1 | File "/usr/lib/python2.7/dist-packages/gunicorn/arbiter.py", line 515, in spawn_worker
01:53:43 web.1 | worker.init_process()
01:53:43 web.1 | File "/usr/lib/python2.7/dist-packages/gunicorn/workers/base.py", line 122, in init_process
01:53:43 web.1 | self.load_wsgi()
01:53:43 web.1 | File "/usr/lib/python2.7/dist-packages/gunicorn/workers/base.py", line 130, in load_wsgi
01:53:43 web.1 | self.wsgi = self.app.wsgi()
01:53:43 web.1 | File "/usr/lib/python2.7/dist-packages/gunicorn/app/base.py", line 67, in wsgi
01:53:43 web.1 | self.callable = self.load()
01:53:43 web.1 | File "/usr/lib/python2.7/dist-packages/gunicorn/app/wsgiapp.py", line 65, in load
01:53:43 web.1 | return self.load_wsgiapp()
01:53:43 web.1 | File "/usr/lib/python2.7/dist-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
01:53:43 web.1 | return util.import_app(self.app_uri)
01:53:43 web.1 | File "/usr/lib/python2.7/dist-packages/gunicorn/util.py", line 366, in import_app
01:53:43 web.1 | __import__(module)
01:53:43 web.1 | File "/home/palak/python-getting-started/gettingstarted/wsgi.py", line 13, in <module>
01:53:43 web.1 | from django.core.wsgi import get_wsgi_application
01:53:43 web.1 | ImportError: No module named django.core.wsgi
01:53:43 web.1 | Traceback (most recent call last):
01:53:43 web.1 | File "/usr/lib/python2.7/dist-packages/gunicorn/arbiter.py", line 515, in spawn_worker
01:53:43 web.1 | worker.init_process()
01:53:43 web.1 | File "/usr/lib/python2.7/dist-packages/gunicorn/workers/base.py", line 122, in init_process
01:53:43 web.1 | self.load_wsgi()
01:53:43 web.1 | File "/usr/lib/python2.7/dist-packages/gunicorn/workers/base.py", line 130, in load_wsgi
01:53:43 web.1 | self.wsgi = self.app.wsgi()
01:53:43 web.1 | File "/usr/lib/python2.7/dist-packages/gunicorn/app/base.py", line 67, in wsgi
01:53:43 web.1 | self.callable = self.load()
01:53:43 web.1 | File "/usr/lib/python2.7/dist-packages/gunicorn/app/wsgiapp.py", line 65, in load
01:53:43 web.1 | return self.load_wsgiapp()
01:53:43 web.1 | File "/usr/lib/python2.7/dist-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
01:53:43 web.1 | return util.import_app(self.app_uri)
01:53:43 web.1 | File "/usr/lib/python2.7/dist-packages/gunicorn/util.py", line 366, in import_app
01:53:43 web.1 | __import__(module)
01:53:43 web.1 | File "/home/palak/python-getting-started/gettingstarted/wsgi.py", line 13, in <module>
01:53:43 web.1 | from django.core.wsgi import get_wsgi_application
01:53:43 web.1 | ImportError: No module named django.core.wsgi
01:53:43 web.1 | [2017-12-30 01:53:43 +0000] [13119] [INFO] Worker exiting (pid: 13119)
01:53:43 web.1 | [2017-12-30 01:53:43 +0000] [13114] [INFO] Shutting down: Master
01:53:43 web.1 | [2017-12-30 01:53:43 +0000] [13114] [INFO] Reason: Worker failed to boot.
01:53:43 web.1 Exited with exit code 3
在安装django并且在python3.6中工作时默认查看python2.7
如何从python2.7将此路径更改为python3.6? 非常感谢。
答案 0 :(得分:0)
在运行'heroku local'之前需要启用虚拟环境 要激活virtualenv:
pipenv shell