Answers for "flask heroku"

2

python flask on heroku

# If not intalled & logged in yet:
sudo snap install heroku --classic
heroku login

####### Sample repo by heroku #####
git clone https://github.com/heroku/python-getting-started.git
cd python-getting-started

####### Manual configs ############
#sample Procfile for flask
> web: gunicorn --bind 0.0.0.0:$PORT app:app
#populate requirements.txt
#sample py version in runtime.txt
> python-3.9.6

###### Create & Deploy ############
#create app from CLI
heroku create app-name
#every push will re-deploy the updated code
git push heroku main
#Ensure server is UP
heroku ps:scale web=1
#Continous Logging
heroku logs --tail
Posted by: Guest on July-03-2021
1

flask heroku

If u get "No web processes running" Error, Make Sure:
  1. your main file is 'app.py' and your main func is app [ app = Flask(__name__), app.run() ]
  2. you added gunicorn==20.1.0 to your requirements.txt file
  3. you have Procfile with the following line 'web: gunicorn app:app'
Posted by: Guest on July-30-2021
0

heroku python heroku port issue

import os 
port = int(os.environ.get('PORT', 33507))  # add these lines in code
app.run(host=args.host, port=port, debug=True)  

heroku config:add PORT=33507   # run this command once you upadte the code in terminal
Posted by: Guest on December-08-2020
0

dev.to flask heroku

% heroku login
% git init
% heroku git:remote -a codingx-python
% git add.
% git commit -am "First python app"
% git push heroku master
Posted by: Guest on September-10-2021

Python Answers by Framework

Browse Popular Code Answers by Language