2012-12-15 64 views
4

我正在爲Python開發者做Heroku演練:https://devcenter.heroku.com/articles/django#prerequisites,並且在嘗試運行「git push heroku master」時出現錯誤,它可以是在「部署到Heroku」部分下找到約1/3的頁面。我得到以下回溯:Heroku推送被拒絕,未能編譯Python/Django應用程序(Python 2.7)

Counting objects: 11, done. 
Delta compression using up to 4 threads. 
Compressing objects: 100% (9/9), done. 
Writing objects: 100% (11/11), 3.71 KiB, done. 
Total 11 (delta 0), reused 0 (delta 0) 
-----> Python/Django app detected 
-----> Preparing Python interpreter (2.7.2) 
-----> Creating Virtualenv (1.8.4) 
     Also creating executable in .heroku/venv/bin/python 
     Installing distribute...done. 
     Installing pip...done. 
     Running virtualenv with interpreter /usr/local/bin/python2.7 
-----> Installing dependencies using pip (1.1) 
     Exception: 
     Traceback (most recent call last): 
     File "/tmp/build_21leaqqhryfxe/.heroku/venv/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/basecommand.py", 
line 104, in main 
      status = self.run(options, args) 
     File "/tmp/build_21leaqqhryfxe/.heroku/venv/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/commands/install. 
py", line 219, in run 
      for req in parse_requirements(filename, finder=finder, options=options): 
     File "/tmp/build_21leaqqhryfxe/.heroku/venv/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/req.py", line 128 
8, in parse_requirements 
      req = InstallRequirement.from_line(line, comes_from) 
     File "/tmp/build_21leaqqhryfxe/.heroku/venv/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/req.py", line 85, 
in from_line 
      elif os.path.isdir(path) and (os.path.sep in name or name.startswith('.')): 
     File "/tmp/build_21leaqqhryfxe/.heroku/venv/lib/python2.7/genericpath.py", line 41, in isdir 
      st = os.stat(s) 
     TypeError: must be encoded string without NULL bytes, not str 

     Storing complete log in /app/.pip/pip.log 
!  Heroku push rejected, failed to compile Python/django app 

To [email protected]:stark-fortress-9694.git 
! [remote rejected] master -> master (pre-receive hook declined) 
error: failed to push some refs to '[email protected]:stark-fortress-9694.git' 

其他一切都成功地工作到這一點。任何見解?我對此完全陌生。感謝您提前提供任何幫助。

這裏是requirements.txt樣子:

Django==1.4.3 
distribute==0.6.31 
dj-database-url==0.2.1 
psycopg2==2.4.5 
+0

好像你的需求之一是未能安裝。你能提供你的requirements.txt文件嗎? –

+0

1.你在本地運行它嗎? 2.您是否通過短毛工具運行它? 3.你到目前爲止進行了哪種測試? – bitcycle

+0

我加了Django的標籤,蜜蜂通過Django的人看到太.. –

回答

12

我認爲這個問題是在你的requirements.txt文件的編碼。可能你不知不覺地用Unicode格式保存它。您應該將其保存爲ANSI格式。請參閱此鏈接瞭解詳情:http://georgik.sinusgear.com/2012/08/20/problems-with-deploying-heroku-django-app-from-windows/

+0

我的編碼沒有問題,但是我有一個從GitHub存儲庫安裝的軟件包,它在'requirements.txt'中的行引發了錯誤。 – Filly

+0

它也爲我解決了它。提示:不要忘記在修復之後再次提交,我確定它不起作用,因爲我推送時沒有提交固定文件:) – syonip

相關問題