简体   繁体   中英

Can't find web process procfile error with Windows Heroku

I want to deploy my website which works locally, but runs an error when it tries to have a public instance.

I am on Windows 8.1 and following the official instructions have created a Procfile.windows . It looks like this:

web: python app.py runserver 0.0.0.0:5000

The build works, but then I get this error when I run heroku ps:scale web=1 :

Couldn't find that process type (web).

Repo here .

The official tutorial works, so there's definitely proof of concept of this working somehow.

I am on Windows 8.1 and following the official instructions have created a Procfile.windows

Why did you name this file Procfile.windows ? The documentation is quite clear :

The Procfile is always a simple text file that is named Procfile without a file extension . For example, Procfile.txt is not valid.

Rename it to Procfile and redeploy.

Once you've got that working, install a WSGI server and use that instead of manage.py runserver , which isn't suitable for production use :

DO NOT USE THIS SERVER IN A PRODUCTION SETTING. It has not gone through security audits or performance tests. (And that's how it's gonna stay. We're in the business of making Web frameworks, not Web servers, so improving this server to be able to handle a production environment is outside the scope of Django.)

Gunicorn is probably the most common choice, but I don't think it works on Windows so you won't be able to use it in your development environment. uWSGI or Waitress should work.

I installed Waitress and changed my Procfile to web: waitress-serve --port=$PORT app:app

I also removed the.windows extension, which is meant for local development.

It works fine now!

(My equivalent to "main.py" was "app.py" so you'd likely change this for your needs to {main.py}:app )

Edit your procfile to look like

    web: gunicorn --bind 0.0.0.0:$PORT app:app

And your procfile.windows filed as

    web: python app.py runserver 0.0.0.0:5000

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM