Heroku:没有 NULL 字节的字符串,有几个需求文件
Heroku: string without NULL bytes with several requirements files
我正在尝试按照 "Two scoops of Django 1.6" 项目结构从 Ubuntu 在 Heroku 中部署 Django 网络应用程序。
完成 heroku create 后,我 运行 git push heroku master 并附上输出最后。
我在谷歌上进行了大量搜索,我知道错误是这样的
TypeError: must be encoded string without NULL bytes, not str
是由于需求文件中的一些编码或稀有字符引起的。我的问题是,我尝试以较少的依赖项保存并更改文件中的编码,但没有取得任何成果(我不知道 Heroku 的有效编码,所以我对此视而不见)。
我正在寻找一种查找空字符的方法,即使在命令行中使用 cat -e,但我找不到任何东西。 我正在寻求一种查找编码问题或错误依赖项的方法。
先谢谢你。
编辑: 我试过 pip
install -r <fileName>.txt
我的几个需求 txt 文件。所有的安装都很好。我还尝试执行 git push heroku master,所有内容都在主 requirements.txt(一个空文件)中进行了注释,但它一直出现相同的错误。也许 heroku 没有选择 requirements.txt 文件???
我尝试从命令行重新创建文件并手动输入相同的内容(不是复制粘贴)。同样的错误不断出现。 :-(
文件和输出:
我的需求文件是:
requirements.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
requirements/production.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
和requirements/base.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。
现在终于明白了,push的时候报错又改了
非常感谢您的帮助,很抱歉让您耽误了时间。
我正在尝试按照 "Two scoops of Django 1.6" 项目结构从 Ubuntu 在 Heroku 中部署 Django 网络应用程序。
完成 heroku create 后,我 运行 git push heroku master 并附上输出最后。
我在谷歌上进行了大量搜索,我知道错误是这样的
TypeError: must be encoded string without NULL bytes, not str
是由于需求文件中的一些编码或稀有字符引起的。我的问题是,我尝试以较少的依赖项保存并更改文件中的编码,但没有取得任何成果(我不知道 Heroku 的有效编码,所以我对此视而不见)。
我正在寻找一种查找空字符的方法,即使在命令行中使用 cat -e,但我找不到任何东西。 我正在寻求一种查找编码问题或错误依赖项的方法。
先谢谢你。
编辑: 我试过 pip
install -r <fileName>.txt
我的几个需求 txt 文件。所有的安装都很好。我还尝试执行 git push heroku master,所有内容都在主 requirements.txt(一个空文件)中进行了注释,但它一直出现相同的错误。也许 heroku 没有选择 requirements.txt 文件???
我尝试从命令行重新创建文件并手动输入相同的内容(不是复制粘贴)。同样的错误不断出现。 :-(
文件和输出:
我的需求文件是:
requirements.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
requirements/production.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
和requirements/base.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。
现在终于明白了,push的时候报错又改了
非常感谢您的帮助,很抱歉让您耽误了时间。