2012-11-10 37 views
1

我正在嘗試安裝New Relic,但它說我需要對Procfile進行更改。雖然我似乎無法在本地應用程序的根目錄找到它。我正在使用Django。Procfile在哪裏?

感謝

回答

0

在Heroku本頁提供了更多信息的procfile是什麼: https://devcenter.heroku.com/articles/procfile

你不必有一個部署到Heroku的,但你可以手動創建一個更好地控制Heroku如何運行您的應用程序。根據以上鍊接摘錄:

Procfile不需要部署使用Heroku支持的大多數語言編寫的應用程序。平臺自動檢測語言,並創建一個默認的Web進程類型來啓動應用程序服務器。

建議創建一個明確的Procfile,以便對應用程序進行更好的控制和靈活性。

對於Heroku上使用您的Procfile,添加Procfile到應用程序推的根目錄下的Heroku:

$ git add . 
$ git commit -m "Procfile" 
$ git push heroku 
... 
-----> Procfile declares process types: web, worker 
     Compiled slug size is 10.4MB 
-----> Launching... done 
     http://strong-stone-297.herokuapp.com deployed to Heroku 

To [email protected]:strong-stone-297.git 
* [new branch]  master -> master 
0

對於New Relic的支持,你必須明確地告訴Heroku的內運行gunicorn實例新的遺物。所以,你會Procfile這個樣子:

Procfile: 
    web: bash scripts/heroku_run 
scripts/heroku_run: 
    #!/bin/bash 

    run_command="gunicorn --workers 4 --worker-class gevent --timeout 60 mysite.wsgi" 

    # Run through New Relic monitoring if add-on installed 
    if [[ $NEW_RELIC_LICENSE_KEY != '' ]]; then 
     newrelic-admin run-program $run_command 
    else 
     $run_command 
    fi 

newrelic-admin run-program gunicorn --workers 4 --worker-class gevent --timeout 60 mysite.wsgi 

您可以通過有條件地尋找Heroku的環境變量的New Relic的許可證開啓或關閉此不改變你Procfile