1# If not intalled & logged in yet:
2sudo snap install heroku --classic
3heroku login
4
5####### Sample repo by heroku #####
6git clone https://github.com/heroku/python-getting-started.git
7cd python-getting-started
8
9####### Manual configs ############
10#sample Procfile for flask
11> web: gunicorn --bind 0.0.0.0:$PORT app:app
12#populate requirements.txt
13#sample py version in runtime.txt
14> python-3.9.6
15
16###### Create & Deploy ############
17#create app from CLI
18heroku create app-name
19#every push will re-deploy the updated code
20git push heroku main
21#Ensure server is UP
22heroku ps:scale web=1
23#Continous Logging
24heroku logs --tail
1If u get "No web processes running" Error, Make Sure:
2 1. your main file is 'app.py' and your main func is app [ app = Flask(__name__), app.run() ]
3 2. you added gunicorn==20.1.0 to your requirements.txt file
4 3. you have Procfile with the following line 'web: gunicorn app:app'
1import os
2port = int(os.environ.get('PORT', 33507)) # add these lines in code
3app.run(host=args.host, port=port, debug=True)
4
5heroku config:add PORT=33507 # run this command once you upadte the code in terminal
1% heroku login
2% git init
3% heroku git:remote -a codingx-python
4% git add.
5% git commit -am "First python app"
6% git push heroku master
7