2016-03-06 89 views
4

我試圖將一個基本的Python博客/網站遷移到Heroku,將其部署到互聯網。我部分通過這個過程,並且無法正確獲取Procfile。我遵循here for Heroku的說明。Heroku Procfile的正確目錄

「Mysite」是我網站的頂級目錄。我已經把virtualenv放在它裏面,按照instuctions。

我不知道在哪裏的Procfile需要去 - 這裏是我遇到的錯誤:

C:\Users\andre\mysite>virtualenv venv 
Using base prefix 'c:\\users\\andre\\appdata\\local\\programs\\python\\python35-32' 
New python executable in venv\Scripts\python.exe 
Installing setuptools, pip, wheel...done. 

C:\Users\andre\mysite>venv\Scripts\activate 
(venv) C:\Users\andre\mysite>pip freeze > requirements.txt 
You are using pip version 7.1.2, however version 8.1.0 is available. 
You should consider upgrading via the 'python -m pip install --upgrade pip' command. 

(venv) C:\Users\andre\mysite>pip install -r requirements.txt 
Requirement already satisfied (use --upgrade to upgrade): wheel==0.24.0 in c:\users\andre\mysite\venv\lib\site-packages (from -r requirements.txt (line 1)) 
You are using pip version 7.1.2, however version 8.1.0 is available. 
You should consider upgrading via the 'python -m pip install --upgrade pip' command. 

(venv) C:\Users\andre\mysite>heroku local web 
ERROR: open Procfile: The system cannot find the file specified. 

我已經嘗試放置Procfile幾個不同的地方,但還沒有任何運氣消除錯誤。

我使用的Procfile有以下內容:

web: gunicorn mysite.wsgi --log-file - 

文件目錄如下:

andre/ 
    -Documents/ 
    -Desktop/ 
    -AppData/ 
     -Local/ 
      -heroku/ 
    -mysite/ 
     -blog/ 
     -mysite/ 
     -venv/ 
     -db.sqlite3 
     -manage.py 
     -Procfile 
     -requirements.txt 

任何建議我可能是錯在這裏做什麼?謝謝。

回答

3

將其上移一個目錄到存儲庫的根目錄,並刪除.txt擴展名。 From the documentation

Procfile是一個名爲Procfile的文件。它應該被命名爲Procfile,而不是別的。例如,Procfile.txt無效。該文件應該是一個簡單的文本文件。

該文件必須放置在應用程序的根目錄中。如果放置在子目錄中,它將不起作用。

本文檔適用於Heroku支持的所有語言。當文檔中提到「應用程序的根源」時,它指的是根目錄,而不是Django應用程序。

+0

謝謝克里斯。我試圖在目錄中移動Procfile,但這沒有幫助 - 導致同樣的錯誤。我已經修改過,以顯示我的目錄更深入一點,可能會提供更多的信息。基本上,「andre」文件夾是我的電腦的一個通用目錄。另外,我已經觸及Procfile的「.txt」,但這也沒有幫助。 – AME

+0

@AME,看起來你的'Procfile'引用了一個不存在的文件:'mysite.wsgi'。你有WSGI文件嗎? – Chris

+0

這是正確的,克里斯,我假設配置/定位WSGI文件將在後來的過程中,雖然我可能會誤會。你認爲這是問題嗎?我認爲問題在於Procfile並沒有被放置在第一位。我在目錄(@ andre/mysite/mysite/wsgi.py)中有一個WSGI.py文件。應該把東西搬到那裏?再次感謝。 – AME