-
Add PUBLIC SSH Key to Heroku :
$heroku keys:add
-
Provide a unique name (For ur application):
$heroku create <unique-name>
-
Deploy the changes :
$git push heroku master
-
Longin to Heroku
$heroku login
-
Provide a unique name (For ur application):
$heroku create <unique-name>
-
Check addons
$heroku addons
-
Add addons
$ heroku addons:create heroku-postgresql:<plan-name> --app <heroku-app-name>
Note-
Heroku has two basic plans-
- hobby-dev
- hobby-basic
Heroku-app-name = the unique name that we created for the app
-
Handling config vars if any-
-
List all config vars:
$ heroku config
-
Get specific config var:
$ heroku config:get GITHUB_USERNAME
-
Set congig var:
$ heroku config:set GITHUB_USERNAME=joesmith
-
Remove a config var:
$ heroku config:unset GITHUB_USERNAME=joesmith
-
-
Handling Procfile-
- Create Procfile in project's root directory w/o extension-
$ touch Procfile
- Insert into procfile(run.py contains app var.)-
web: gunicorn run:app
- Create Procfile in project's root directory w/o extension-
-
Create runtime.txt in project's root directory & specify the used python version-
$ touch runtime.txt
- inside the runtime.txt
python-3.6.9
-
Create requirements.txt file-
- This step must be followed after step 7, if in any case problem occurs, delete this file and again create.
$ pip freeze > requirements.txt
- If pkg-resources==0.0.0 exists, then remove it, it may cause build-failure.
-
Finally, go to your heroku app's deploy section, then grab the command to add remote and push to master branch.
It's not done yet
- Start the python interpretor to create the database:
$ heroku run python
- in python interpretor create db as-
from sweats import db, create_app db.create_all(app=create_app()) exit()
-
Finally, type to open website:
$ heroku open
-
Open DB in the heroku server-
$ heroku pg:psql --app sweats
Query: sweats::DATABASE=> SELECT * FROM customers;