我需要一点帮助。在制作了django应用之后,我想用heroku做点什么。但是,当我想运行heroku local web
时,我的heroku使用的是我的python(2.7版),但是我需要使用python3(版本3.7)。我正在使用ubuntu升级到最新版本。这些是我的错误:
root@rudepeeter-VirtualBox:/home/rudepeeter/Documents/heroku_game/python-getting-started# /snap/bin/heroku local web [OKAY] Loaded ENV .env File as KEY=VALUE Format 9:52:24 AM web.1 | [2019-02-20 09:52:24 +0000] [3601] [INFO] Starting gunicorn 19.9.0 9:52:24 AM web.1 | [2019-02-20 09:52:24 +0000] [3601] [INFO] Listening at: http://0.0.0.0:5000 (3601) 9:52:24 AM web.1 | [2019-02-20 09:52:24 +0000] [3601] [INFO] Using worker: sync 9:52:24 AM web.1 | [2019-02-20 09:52:24 +0000] [3605] [INFO] Booting worker with pid: 3605 9:52:24 AM web.1 | [2019-02-20 09:52:24 +0000] [3605] [ERROR] Exception in worker process 9:52:24 AM web.1 | Traceback (most recent call last): 9:52:24 AM web.1 | File "/usr/local/lib/python2.7/dist-packages/gunicorn/arbiter.py", line 583, in spawn_worker 9:52:24 AM web.1 | worker.init_process() 9:52:24 AM web.1 | File "/usr/local/lib/python2.7/dist-packages/gunicorn/workers/base.py", line 129, in init_process 9:52:24 AM web.1 | self.load_wsgi() 9:52:24 AM web.1 | File "/usr/local/lib/python2.7/dist-packages/gunicorn/workers/base.py", line 138, in load_wsgi 9:52:24 AM web.1 | self.wsgi = self.app.wsgi() 9:52:24 AM web.1 | File "/usr/local/lib/python2.7/dist-packages/gunicorn/app/base.py", line 67, in wsgi 9:52:24 AM web.1 | self.callable = self.load() 9:52:24 AM web.1 | File "/usr/local/lib/python2.7/dist-packages/gunicorn/app/wsgiapp.py", line 52, in load 9:52:24 AM web.1 | return self.load_wsgiapp() 9:52:24 AM web.1 | File "/usr/local/lib/python2.7/dist-packages/gunicorn/app/wsgiapp.py", line 41, in load_wsgiapp 9:52:24 AM web.1 | return util.import_app(self.app_uri) 9:52:24 AM web.1 | File "/usr/local/lib/python2.7/dist-packages/gunicorn/util.py", line 350, in import_app 9:52:24 AM web.1 | __import__(module) 9:52:24 AM web.1 | File "/home/rudepeeter/Documents/heroku_game/python-getting-started/gettingstarted/wsgi.py", line 16, in <module> 9:52:24 AM web.1 | application = get_wsgi_application() 9:52:24 AM web.1 | File "/usr/local/lib/python2.7/dist-packages/django/core/wsgi.py", line 13, in get_wsgi_application 9:52:24 AM web.1 | django.setup(set_prefix=False) 9:52:24 AM web.1 | File "/usr/local/lib/python2.7/dist-packages/django/__init__.py", line 22, in setup 9:52:24 AM web.1 | configure_logging(settings.LOGGING_CONFIG, settings.LOGGING) 9:52:24 AM web.1 | File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 56, in __getattr__ 9:52:24 AM web.1 | self._setup(name) 9:52:24 AM web.1 | File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 41, in _setup 9:52:24 AM web.1 | self._wrapped = Settings(settings_module) 9:52:24 AM web.1 | File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 110, in __init__ 9:52:24 AM web.1 | mod = importlib.import_module(self.SETTINGS_MODULE) 9:52:24 AM web.1 | File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module 9:52:24 AM web.1 | __import__(name) 9:52:24 AM web.1 | File "/home/rudepeeter/Documents/heroku_game/python-getting-started/gettingstarted/settings.py", line 14, in <module> 9:52:24 AM web.1 | import django_heroku 9:52:24 AM web.1 | File "/usr/local/lib/python2.7/dist-packages/django_heroku/__init__.py", line 1, in <module> 9:52:24 AM web.1 | from .core import * 9:52:24 AM web.1 | File "/usr/local/lib/python2.7/dist-packages/django_heroku/core.py", line 45 9:52:24 AM web.1 | def settings(config, *, db_colors=False, databases=True, test_runner=True, staticfiles=True, allowed_hosts=True, logging=True, secret_key=True): 9:52:24 AM web.1 | ^ 9:52:24 AM web.1 | SyntaxError: invalid syntax 9:52:24 AM web.1 | [2019-02-20 09:52:24 +0000] [3605] [INFO] Worker exiting (pid: 3605) 9:52:24 AM web.1 | [2019-02-20 09:52:24 +0000] [3601] [INFO] Shutting down: Master 9:52:24 AM web.1 | [2019-02-20 09:52:24 +0000] [3601] [INFO] Reason: Worker failed to boot. [DONE] Killing all processes with signal SIGINT 9:52:24 AM web.1 Exited with exit code null
我认为这是因为heroku使用的是python命令而不是python3,但是我该如何更改呢?请帮忙。