简体   繁体   中英

Deploying a python flask web application on Heroku with Windows

I am trying to deploy a flask app I made to Heroku with success. The app is generated but I get errors when I push the code to the Heroku repository.

My flask app is inside a module called server.py and the variable is named app. At first I tried using gunicorn and writing web: gunicorn server:app and deplying but no web dynos were up and I get an error stating it is the Procfile file. Red about it about and saw that Gunicorn is not really working on windows so I tried installing Waitress and deploying without success. this time my profcile was written as all of these (tried several times):

web: waitress-serve --listen=*:8000 server.wsgi:application

web: waitress-serve --listen=*:8000 app.wsgi:application And so on.

to add a web dyno I should scale it because heroku ps: showes that there is no dynos.

When I try to run heroku ps:scale web=1 I get:

Scaling dynos... ! ▸ Couldn't find that process type.

What am i doing wrong?

I was having the same problem. Particularly, waitress works locally in Windows (inside a Procfile.windows file web: waitress-serve index:server , then with heroku CLI heroku local -f Procfile.windows ), but failed after Heroku deployment. Workaround for me was to locally test with waitress (like explained), but deploy with gunicorn ( web: gunicorn index:server inside Procfile). Let me know if this works for you.

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