【发布时间】:2020-11-26 15:35:13
【问题描述】:
我是 Django / Python 新手,正在尝试将我的第一个项目部署到 Heroku。我收到以下错误,并且一直在遵循这封信指南:William S Vincent 的“初学者 Django”。
当我运行时:$git push heroku master
我明白了:
错误:! [remote denied] master -> master (pre-receive hook denied) 错误:未能将一些参考推送到“https://git.heroku.com/stark-dawn-54447.git”
我已经包含了下面返回的所有代码...
非常感谢
-----> Python app detected
-----> Installing python-3.8.5
-----> Installing pip 9.0.2, setuptools 47.1.1 and wheel 0.34.2
-----> Installing dependencies with Pipenv 2018.5.18…
Traceback (most recent call last):
File "/tmp/build_4d226441/.heroku/python/lib/python3.8/site-packages/pipenv/patched/prettytoml/elements/abstracttable.py", line 27, in _enumerate_items
yield next(non_metadata), next(non_metadata)
StopIteration
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/app/.heroku/python/lib/python3.8/site-packages/pipenv/project.py", line 438, in _parse_pipfile
return contoml.loads(contents)
File "/tmp/build_4d226441/.heroku/python/lib/python3.8/site-packages/pipenv/patched/contoml/__init__.py", line 15, in loads
elements = parse_tokens(tokens)
File "/tmp/build_4d226441/.heroku/python/lib/python3.8/site-packages/pipenv/patched/prettytoml/parser/__init__.py", line 17, in parse_tokens
return _parse_token_stream(TokenStream(tokens))
File "/tmp/build_4d226441/.heroku/python/lib/python3.8/site-packages/pipenv/patched/prettytoml/parser/__init__.py", line 29, in _parse_token_stream
elements, pending = toml_file_elements(token_stream)
File "/tmp/build_4d226441/.heroku/python/lib/python3.8/site-packages/pipenv/patched/prettytoml/parser/parser.py", line 375, in toml_file_elements
captured = capture_from(token_stream).find(one).or_find(file_entry_element).or_empty()
File "/tmp/build_4d226441/.heroku/python/lib/python3.8/site-packages/pipenv/patched/prettytoml/parser/recdesc.py", line 33, in find
element, pending_ts = finder(self._token_stream)
File "/tmp/build_4d226441/.heroku/python/lib/python3.8/site-packages/pipenv/patched/prettytoml/parser/parser.py", line 372, in one
c1 = capture_from(ts1).find(file_entry_element).and_find(toml_file_elements)
File "/tmp/build_4d226441/.heroku/python/lib/python3.8/site-packages/pipenv/patched/prettytoml/parser/recdesc.py", line 109, in and_find
return Capturer(self.pending_tokens, self.value()).find(finder)
File "/tmp/build_4d226441/.heroku/python/lib/python3.8/site-packages/pipenv/patched/prettytoml/parser/recdesc.py", line 33, in find
element, pending_ts = finder(self._token_stream)
File "/tmp/build_4d226441/.heroku/python/lib/python3.8/site-packages/pipenv/patched/prettytoml/parser/parser.py", line 375, in toml_file_elements
captured = capture_from(token_stream).find(one).or_find(file_entry_element).or_empty()
File "/tmp/build_4d226441/.heroku/python/lib/python3.8/site-packages/pipenv/patched/prettytoml/parser/recdesc.py", line 33, in find
element, pending_ts = finder(self._token_stream)
File "/tmp/build_4d226441/.heroku/python/lib/python3.8/site-packages/pipenv/patched/prettytoml/parser/parser.py", line 372, in one
c1 = capture_from(ts1).find(file_entry_element).and_find(toml_file_elements)
File "/tmp/build_4d226441/.heroku/python/lib/python3.8/site-packages/pipenv/patched/prettytoml/parser/recdesc.py", line 33, in find
element, pending_ts = finder(self._token_stream)
File "/tmp/build_4d226441/.heroku/python/lib/python3.8/site-packages/pipenv/patched/prettytoml/parser/parser.py", line 364, in file_entry_element
captured = capture_from(token_stream).find(table_header_element).\
File "/tmp/build_4d226441/.heroku/python/lib/python3.8/site-packages/pipenv/patched/prettytoml/parser/recdesc.py", line 79, in or_find
return Capturer(self._token_stream).find(finder)
File "/tmp/build_4d226441/.heroku/python/lib/python3.8/site-packages/pipenv/patched/prettytoml/parser/recdesc.py", line 33, in find
element, pending_ts = finder(self._token_stream)
File "/tmp/build_4d226441/.heroku/python/lib/python3.8/site-packages/pipenv/patched/prettytoml/parser/parser.py", line 350, in table_body_element
return TableElement(captured.value()), captured.pending_tokens
File "/tmp/build_4d226441/.heroku/python/lib/python3.8/site-packages/pipenv/patched/prettytoml/elements/table.py", line 22, in __init__
self._check_for_duplicate_keys()
File "/tmp/build_4d226441/.heroku/python/lib/python3.8/site-packages/pipenv/patched/prettytoml/elements/table.py", line 25, in _check_for_duplicate_keys
if len(set(self.keys())) < len(self.keys()):
File "/tmp/build_4d226441/.heroku/python/lib/python3.8/site-packages/pipenv/patched/prettytoml/elements/abstracttable.py", line 37, in keys
return tuple(key for (key, _) in self.items())
File "/tmp/build_4d226441/.heroku/python/lib/python3.8/site-packages/pipenv/patched/prettytoml/elements/abstracttable.py", line 37, in <genexpr>
return tuple(key for (key, _) in self.items())
File "/tmp/build_4d226441/.heroku/python/lib/python3.8/site-packages/pipenv/patched/prettytoml/elements/abstracttable.py", line 30, in items
for (key_i, key), (value_i, value) in self._enumerate_items():
RuntimeError: generator raised StopIteration
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/app/.heroku/python/bin/pipenv", line 11, in <module>
sys.exit(cli())
File "/tmp/build_4d226441/.heroku/python/lib/python3.8/site-packages/pipenv/vendor/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/tmp/build_4d226441/.heroku/python/lib/python3.8/site-packages/pipenv/vendor/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/tmp/build_4d226441/.heroku/python/lib/python3.8/site-packages/pipenv/vendor/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/tmp/build_4d226441/.heroku/python/lib/python3.8/site-packages/pipenv/vendor/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/tmp/build_4d226441/.heroku/python/lib/python3.8/site-packages/pipenv/vendor/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/app/.heroku/python/lib/python3.8/site-packages/pipenv/cli.py", line 385, in install
do_install(
File "/app/.heroku/python/lib/python3.8/site-packages/pipenv/core.py", line 1785, in do_install
pre = project.settings.get('allow_prereleases')
File "/app/.heroku/python/lib/python3.8/site-packages/pipenv/project.py", line 446, in settings
return self.parsed_pipfile.get('pipenv', {})
File "/app/.heroku/python/lib/python3.8/site-packages/pipenv/project.py", line 392, in parsed_pipfile
parsed = self._parse_pipfile(contents)
File "/app/.heroku/python/lib/python3.8/site-packages/pipenv/project.py", line 441, in _parse_pipfile
return toml.loads(contents)
File "/tmp/build_4d226441/.heroku/python/lib/python3.8/site-packages/pipenv/vendor/toml.py", line 342, in loads
raise TomlDecodeError("What? " + group +
toml.TomlDecodeError: What? requires already exists?{'source': [{'name': 'pypi', 'url': 'https://pypi.org/simple', 'verify_ssl': True}], 'dev-packages': {}, 'packages': {'django': '==3.0.1'}, 'requires': {'python_version': '3.8'}}
! Push rejected, failed to compile Python app.
! Push failed
【问题讨论】:
-
您的 Pipenv 导致错误。分享您的
Pipfile或requirements.txt。虽然我几乎不与 Pipenv 合作,所以其他人将不得不进一步研究它 -
嘿,谢谢... pipenv 内容如下: [[source]] name = "pypi" url = "pypi.org/simple" verify_ssl = true [dev-packages] [packages] django = "==3.0.1" [需要] python_version = "3.8" [需要] python_version = "3.7" Requirements.txt : asgiref==3.2.10 Django==3.0.1 gunicorn==19.9.0 pytz==2020.1 sqlparse==0.3.1
标签: python django git heroku deployment