0

当我将git push我的 Django 应用程序加载到 Heroku 时,我收到以下错误。我怎么知道我的代码需要从这个错误中改变什么?我不确定我错误配置了哪些日期信息会引发此错误。如果你能指出我正确的方向,那就太好了!当我使用 python 3.6.3 时,我的 Pipfile.lock 设置确实显示了 python 3.6.4。这可能是问题吗?有没有办法更新 Python 而不必重新安装我的所有东西?

remote:          File "/tmp/build_913f5397888fc6f8943894f7ab01ea65/.heroku/python/lib/python3.6/site-packages/pipenv/vendor/toml.py", line 454, in _load_line
remote:            raise TomlDecodeError("Invalid date or number")
remote:        toml.TomlDecodeError: Invalid date or number
remote:  !     Push rejected, failed to compile Python app.

以下是完整的回溯错误:

:\Users\Jup\Drop>git push heroku master
Counting objects: 19, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (15/15), done.
Writing objects: 100% (19/19), 8.93 KiB | 0 bytes/s, done.
Total 19 (delta 8), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Python app detected
remote:  !     The latest version of Python 3 is python-3.6.4 (you are using python-3.6.3, which is unsupported).
remote:  !     We recommend upgrading by specifying the latest version (python-3.6.4).
remote:        Learn More: https://devcenter.heroku.com/articles/python-runtimes
remote: -----> Installing requirements with latest Pipenv…
remote:        Traceback (most recent call last):
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/pipenv/project.py", line 272, in parsed_pipfile
remote:            return contoml.loads(contents)
remote:          File "/tmp/build_913f5397888fc6f8943894f7ab01ea65/.heroku/python/lib/python3.6/site-packages/pipenv/patched/contoml/__init__.py", line 15, in loa
ds
remote:            elements = parse_tokens(tokens)
remote:          File "/tmp/build_913f5397888fc6f8943894f7ab01ea65/.heroku/python/lib/python3.6/site-packages/pipenv/patched/prettytoml/parser/__init__.py", line
17, in parse_tokens
remote:            return _parse_token_stream(TokenStream(tokens))
remote:          File "/tmp/build_913f5397888fc6f8943894f7ab01ea65/.heroku/python/lib/python3.6/site-packages/pipenv/patched/prettytoml/parser/__init__.py", line
32, in _parse_token_stream
remote:            raise ParsingError('Failed to parse line {}'.format(pending.head.row))
remote:        prettytoml.parser.errors.ParsingError: Failed to parse line 15
remote:
remote:        During handling of the above exception, another exception occurred:
remote:
remote:        Traceback (most recent call last):
remote:          File "/app/.heroku/python/bin/pipenv", line 11, in <module>
remote:            sys.exit(cli())
remote:          File "/tmp/build_913f5397888fc6f8943894f7ab01ea65/.heroku/python/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 722, in __call__
remote:            return self.main(*args, **kwargs)
remote:          File "/tmp/build_913f5397888fc6f8943894f7ab01ea65/.heroku/python/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 697, in main
remote:            rv = self.invoke(ctx)
remote:          File "/tmp/build_913f5397888fc6f8943894f7ab01ea65/.heroku/python/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 1066, in invoke
remote:            return _process_result(sub_ctx.command.invoke(sub_ctx))
remote:          File "/tmp/build_913f5397888fc6f8943894f7ab01ea65/.heroku/python/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 895, in invoke
remote:            return ctx.invoke(self.callback, **ctx.params)
remote:          File "/tmp/build_913f5397888fc6f8943894f7ab01ea65/.heroku/python/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 535, in invoke
remote:            return callback(*args, **kwargs)
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/pipenv/cli.py", line 1775, in install
remote:            pre = project.settings.get('allow_prereleases')
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/pipenv/project.py", line 293, in settings
remote:            return self.parsed_pipfile.get('pipenv', {})
remote:          File "/app/.heroku/python/lib/python3.6/site-packages/pipenv/project.py", line 274, in parsed_pipfile
remote:            return toml.loads(contents)
remote:          File "/tmp/build_913f5397888fc6f8943894f7ab01ea65/.heroku/python/lib/python3.6/site-packages/pipenv/vendor/toml.py", line 373, in loads
remote:            multibackslash)
remote:          File "/tmp/build_913f5397888fc6f8943894f7ab01ea65/.heroku/python/lib/python3.6/site-packages/pipenv/vendor/toml.py", line 454, in _load_line
remote:            raise TomlDecodeError("Invalid date or number")
remote:        toml.TomlDecodeError: Invalid date or number
remote:  !     Push rejected, failed to compile Python app.
remote:
remote:  !     Push failed
remote: Verifying deploy...
remote:
remote: !       Push rejected to shrouded-ocean-19461.
remote:
To https://git.heroku.com/shrouded-ocean-19461.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/shrouded-ocean-19461.git'

错误可能在我的Pipfile. 不正确的版本号可能是问题吗?

    [[source]]

url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"


[requires]

python_version = "3.6"


[packages]

amqp==2.2.2
anyjson==0.3.3
apache-libcloud==2.2.1
arrow==0.12.0
beautifulsoup4==4.6.0
billiard==3.5.0.3
blessed==1.14.2
bs4==0.0.1
celery==4.1.0
certifi==2017.7.27.1
chardet==3.0.4
click==6.7
cx-Freeze==6.0b1
dj-database-url==0.4.2
Django==2.0
django-celery==3.2.2
django-celery-beat==1.1.0
django-celery-results==1.0.1
django-heroku==0.2.0
django-picklefield==1.0.0
django-q==0.8.1
django-redis-cache==1.7.1
enum-compat==0.0.2
eventlet==0.21.0
flake8==3.5.0
greenlet==0.4.12
gunicorn==19.7.1
idna==2.6
itsdangerous==0.24
Jinja2==2.10
kombu==4.1.0
MarkupSafe==1.0
mccabe==0.6.1
mtgsdk==1.3.1
numpy==1.13.3
olefile==0.44
pandas==0.21.0
pew==1.1.1
Pillow==4.3.0
pipenv==9.0.0
psutil==5.3.1
psycopg2==2.7.3.2
pycodestyle==2.3.1
pycurl==7.43.0.1
pyflakes==1.6.0
python-dateutil==2.6.1
pytz==2017.3
redis==2.10.6
requests==2.18.4
selenium==3.7.0
six==1.11.0
urllib3==1.22
vine==1.1.4
virtualenv==15.1.0
virtualenv-clone==0.2.6
wcwidth==0.1.7
Werkzeug==0.12.2
whitenoise==3.3.1


[dev-packages]
4

2 回答 2

0

问题出在我的 Pipfile.lock 设置上。替换 requirements.text 时,它具有不同的格式。我改变了这样的格式:

Django==2.0

Django = "==2.0"

但这引发了一个不同的错误,如下所示:

Your Pipfile.lock (af8c37) is out of date. Expected: (3ca3d5)

我现在得想办法解决这个问题。如果您有任何想法,请告诉我。谢谢

于 2018-01-08T21:11:46.067 回答
0

Django==2.0有同样的错误,使用示例更改Pipfile 中的所有包对 Django = "==2.0"我有用。

注意:我没有 Pipfile.lock

于 2018-10-03T03:08:07.457 回答