简体   繁体   中英

How do I assign Dynos to Flask App on Heroku?

I have a very simple, working Flask app hosted in this GitHub repository . I am trying to deploy it onto Heroku (I have a free account) using the "App Connected to GitHub" functionality under the "Deploy" tab.

All of my builds and deploys have been successful when I look under the "Activity" tab. However, when I go to "Open App" I get an "Application Error" saying that

An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details. You can do this from the Heroku CLI with the command

When I check the logs I see the line

2020-03-23T06:10:32.045386+00:00 heroku[router]: at=error code=H14 desc="No web processes running"

From searching this error it seems that I have no dynos assigned to this app. I have tried a few different ways of doing this in the terminal as well as in my Procfile, which I am unsure has been made properly.

Here is my Procfile.txt

web: gunicorn wsgi:app
ps:scale web=1

What do I need to do to get this app up and running?

Here is my Procfile.txt

This file should be called Procfile only, with no extension. Rename it.

Also, remove the ps:scale line from your Procfile . That's a Heroku CLI command; it doesn't belong there:

web: gunicorn wsgi:app

I got it working by adding gunicorn to my requirements.txt file:

catboost==0.22
pandas==1.0.3
numpy==1.18.2
Flask==1.1.1
gunicorn==20.0.4

and changing my Procfile to:

web: gunicorn app:app

Ok, after being frustrated for weeks I finally figured out what was wrong with mine. Like you, I have a free version of Heroku. So, first of all make sure you have your requirements as well as Procfile file setup.

Just have this line on your Procfile and deploy the app.

web: gunicorn wsgi:app

If you are still getting the error. On your terminal run

heroku ps

If you get a message saying "No dynos on ... (your heroku app name) "

Then go to heroku on web. Go to your project and under the Resources tab You'll see this button. Check if its turned on. (In the picture, I have my turned on) . https://imgur.com/a/samOIbi

So basically, although you did everything right, the app might be not working because you forgot to turn on the dyno for the Heroku app. Let me know if you have any issues or if it 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