Heroku:没有空字节的字符串,带有多个要求文件



我正在尝试按照"Django 1.6的两个独家新闻"项目结构从Ubuntu在Heroku中部署Django Web应用程序。

完成 heroku 创建后,我运行 git push heroku master,最后附加输出。

我用谷歌搜索了大量内容,我知道错误是这样的

TypeError: must be encoded string without NULL bytes, not str

这是由于需求文件中的某些编码或稀有字符引起的。我的问题是我尝试使用较少的依赖项进行保存并更改文件中的编码,但一无所获(我不知道 Heroku 的有效编码,所以我对此视而不见)。

我正在寻找一种查找空字符的方法,即使在命令行中使用 cat -e,但我找不到任何东西。我正在寻找一种查找编码问题或错误依赖项的方法

提前谢谢你。


编辑:我试着做点子

install -r <fileName>.txt 

与我的几个要求 txt 文件。所有的安装都很好。我还尝试使用主要要求中的所有注释进行 git push heroku master.txt(一个空文件),并且它一直给出相同的错误。也许 heroku 没有选择要求.txt文件???

我尝试从命令行重新创建文件并手动键入相同的内容(而不是复制粘贴)。同样的错误不断出现。:-(

文件和输出:

我的需求文件是:

需求.txt(在项目的最根部):

# This file is here because many Platforms as a Service look for
# requirements.txt in the root directory of a project.
-r requirements/production.txt

要求/生产.txt

# Pro-tip: Try not to put anything here. There should be no dependency in
# production that isn't in development.
-r base.txt
gunicorn==18.0

要求/基础.txt

Django==1.7
psycopg2==2.6
sqlparse==0.1.15
django-debug-toolbar==1.3.0
html5lib==0.999
Pillow==2.8.1
PyPDF2==1.24
reportlab==3.1.44
six==1.9.0
xhtml2pdf==0.0.6

输出

Pushing to https://git.heroku.com/tranquil-cliffs-3699.git
POST git-receive-pack (chunked)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Python app detected
remote: -----> Installing runtime (python-2.7.10)
remote: -----> Installing dependencies with pip
remote: Exception:
remote: Traceback (most recent call last):
remote:   File "/app/.heroku/python/lib/python2.7/site-packages/pip-7.0.1-py2.7.egg/pip/basecommand.py", line 223, in main
remote:     status = self.run(options, args)
remote:   File "/app/.heroku/python/lib/python2.7/site-packages/pip-7.0.1-py2.7.egg/pip/commands/install.py", line 268, in run
remote:     wheel_cache
remote:   File "/app/.heroku/python/lib/python2.7/site-packages/pip-7.0.1-py2.7.egg/pip/basecommand.py", line 287, in populate_requirement_set
remote:     wheel_cache=wheel_cache):
remote:   File "/app/.heroku/python/lib/python2.7/site-packages/pip-7.0.1-py2.7.egg/pip/req/req_file.py", line 86, in parse_requirements
remote:     for req in req_iter:
remote:   File "/app/.heroku/python/lib/python2.7/site-packages/pip-7.0.1-py2.7.egg/pip/req/req_file.py", line 161, in process_line
remote:     for req in parser:
remote:   File "/app/.heroku/python/lib/python2.7/site-packages/pip-7.0.1-py2.7.egg/pip/req/req_file.py", line 86, in parse_requirements
remote:     for req in req_iter:
remote:   File "/app/.heroku/python/lib/python2.7/site-packages/pip-7.0.1-py2.7.egg/pip/req/req_file.py", line 161, in process_line
remote:     for req in parser:
remote:   File "/app/.heroku/python/lib/python2.7/site-packages/pip-7.0.1-py2.7.egg/pip/req/req_file.py", line 86, in parse_requirements
remote:     for req in req_iter:
remote:   File "/app/.heroku/python/lib/python2.7/site-packages/pip-7.0.1-py2.7.egg/pip/req/req_file.py", line 130, in process_line
remote:     wheel_cache=wheel_cache
remote:   File "/app/.heroku/python/lib/python2.7/site-packages/pip-7.0.1-py2.7.egg/pip/req/req_install.py", line 162, in from_line
remote:     if (os.path.isdir(p) and
remote:   File "/app/.heroku/python/lib/python2.7/genericpath.py", line 49, in isdir[K
remote:     st = os.stat(s)
remote: TypeError: must be encoded string without NULL bytes, not str
remote: 
remote: 
remote:  !     Push rejected, failed to compile Python app
remote: 
remote: Verifying deploy...
remote: 
remote: !   Push rejected to tranquil-cliffs-3699.
remote: 
To https://git.heroku.com/tranquil-cliffs-3699.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/tranquil-cliffs-3699.git'

这都是我的错。超级新手愚蠢的错误。我没有在每次编辑后进行 git 提交,所以我总是将相同的错误文件推送到 Heroku。

现在我终于意识到了,当推送错误时,错误已经变成了另一个错误。

非常感谢您的帮助,也很抱歉让您浪费时间。

相关内容

  • 没有找到相关文章

最新更新