问题
I am trying to deploy a simple python app to heroku but I am getting application error while running the command "heroku open".
Below is the list of files and folders in my root directory of the application.
Inside my Procfile, I have written the below code:
web: gunicorn script1:app
This is the first time I am trying to deploy the app to heroku. Below is the sequence of commands I am using for the same:
- Create 3 files in my root folder, requirements.txt, Procfile, runtime.txt.
- Open command prompt, navigate to root folder, run command "heroku login" - Login successful after providing the email.
- "heroku create myappname" - Created the app successfully.
- "git init" - Created the .git folder in my root path.
- "git add ." - Added all the files in the current directory to the git repository successfuly.
- "git config --global user.email "myemail@gmail.com" - Successfully authenticated.
- "git config --global user.name "username"
- "git commit -m "first commit""
- "heroku git:remote --app myappname"
- "git push heroku master" - Successfully detected and deployed the app with a message: Verifying deploy... done.
- "heroku open" - Whenever I run this command I get Application error.
Everything went smoothly till step 10. But, whenever I try opening the app, it gives application error in the browser.
I searched the internet and tried 2 solutions but none of them worked for me:
To run the command before opening heroku - "heroku ps:scale web=1"
To change the run method in the scripts file as :
if __name__ == "__main__": port = int(os.environ.get("PORT", 5000)) app.run(host="0.0.0.0", port=port)
I don't know what I am doing wrong, any help would be greatly appreciated.
Screenshot of error:
Logs:
heroku[router]: at=error code=H14 desc="No web processes running" method=GET path="/" status=503
来源:https://stackoverflow.com/questions/64364849/getting-application-error-while-running-the-python-app-on-heroku