I'm trying to deploy a Django web application in Heroku from Ubuntu following the "Two scoops of Django 1.6" project structure.
After doing heroku create, I run git push heroku master and I get the output attached at the end.
I googled extensively and I'm aware that the error is this
TypeError: must be encoded string without NULL bytes, not str
and it is caused because some encoding or rare characters in requirements files. My problem is that I tried saving with less dependencies and changing encodings in the files and achieved nothing (I don't know the valid encodings for Heroku, so I'm blind at this).
I'm looking for a way of finding the null characters, even with cat -e at the command line, but I can't find anything. I'm asking for a way for finding the encoding problem or the wrong dependency.
Thank you in advanced.
EDIT: I tried doing pip
install -r <fileName>.txt
with several of my requirements txt files. All the installations were fine. I also tried doing the git push heroku master with all commented in the main requirements.txt (an empty file) and it keeps giving the same error. Maybe heroku is not picking the requirements.txt file???
I tried re-creating the files from command line and typing manually the same content (not copy-paste). The same error keeps appearing. :-(
Files and output:
My requirements files are:
requirements.txt (at the very root of the project):
# 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
and 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
the output:
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'
It was all my fault. Super-newbie stupid error. I was not making git commit after each edit, so I was pushing always the same wrong files to Heroku.
Now I finally realized, and when pushing the error has changed to another one.
Thanks a lot for your help and sorry for making you lose your time.