Procfile not found, Heroku python app

2019-03-09 19:54发布

Doing the heroku python demo and having problems with Procfile. I have it in the right directory (alongside requirements.txt, venv/, and app.py) and the file is "Procfile" without .txt extension (as other questions suggest).

Contents of Procfile are:

web: python app.py

Nonetheless, I keep getting the "Procfile does not exist" error when running "foreman start." At my wits end, any suggestions would be appreciated.

Cheers, Thain

EDIT: Retried creating "Procfile" using echo command rather than an editor -

echo "web: python app.py" > Procfile

worked after that, thanks.

6条回答
你好瞎i
2楼-- · 2019-03-09 20:19

Just adding an answer so that this can be closed (or moved from the unanswered questions section).

As noted in the comments, try using the echo command to create the file rather than an editor. I suspect that this is because of a newline char added by most editors that heroku is having a difficult time with.

Example solution (from qn):

echo "web: python app.py" > Procfile
查看更多
Juvenile、少年°
3楼-- · 2019-03-09 20:22

After spending a significant amount of time on this.. I thought it was important to share..

In the root of your directory => touch Procfile git add git commit git push

make sure your Procfile on github is "Procfile" not "procfile"

git push heroku master

It must be the proper case both locally and on github in order for heroku to recognize it.

查看更多
对你真心纯属浪费
4楼-- · 2019-03-09 20:23

I had the same problem but in laravel. As stated above, some text editors e.g Notepad will add the .txt extension by default if you do not specify the file extension.

Therefore you will have Procfile.txt file instead of Procfile file which Heroku will not detect

To avoid this extension addition, use Sublime text editordownload sublime free it will save it without the .txt extension

查看更多
该账号已被封号
5楼-- · 2019-03-09 20:24

delete the .git file from the folder, and try adding your files to git again using the following commands-

git init

git add .

git commit -m "Procfile issue resolved"

heroku git:remote --app yourappname

git push heroku master

heroku open

hope this helps....

查看更多
时光不老,我们不散
6楼-- · 2019-03-09 20:29

The problem is most likely an extension issue. For example, in Windows, a file saved in notepad has a .txt extension by default. However, when you echo it into a file, the file is saved with the right name, in this case: Procfile.

I'm writing this because someone I know had the same problem and this may help others having the same issue.

查看更多
时光不老,我们不散
7楼-- · 2019-03-09 20:33

The easiest way to create a procfile, (without using the IDE and running into problems with the file extension), is to run this code in your terminal.

touch procfile

If you look up "touch", it's actually meant to simply update the timestamp of an existing file, but a handy by-product, is that it CREATES a file, if there isn't one there in the first place.

查看更多
登录 后发表回答