Heroku: Difference between revisions
| Line 20: | Line 20: | ||
==Example== | ==Example== | ||
* from [https://devcenter.heroku.com/articles/getting-started-with-python official tutorial] | ===Official Tutorial=== | ||
* from [https://devcenter.heroku.com/articles/getting-started-with-python official python tutorial] | |||
PS C:\Temp\python-getting-started> heroku login | PS C:\Temp\python-getting-started> heroku login | ||
* clone example | * clone example | ||
| Line 40: | Line 41: | ||
(venv) PS C:\Temp\python-getting-started> heroku local -f .\Procfile.windows | (venv) PS C:\Temp\python-getting-started> heroku local -f .\Procfile.windows | ||
* open it http://localhost:5000/ | * open it http://localhost:5000/ | ||
===Spring Boot=== | |||
* from [https://devcenter.heroku.com/articles/deploying-spring-boot-apps-to-heroku offical Spring Boot tutorial]f | |||
==Resources== | ==Resources== | ||
* [https://devcenter.heroku.com/articles/getting-started-with-python Tutorial] | * [https://devcenter.heroku.com/articles/getting-started-with-python Tutorial] | ||
* [https://dashboard.heroku.com/apps Heroku dashboard] | * [https://dashboard.heroku.com/apps Heroku dashboard] | ||
Revision as of 19:38, 29 March 2022
Installation
Concepts
- all Heroku applications run in a collection of lightweight Linux containers called Dynos. To find out the dynos:
heroku ps
- The set of dynos declared in your Procfile and managed by the dyno manager via heroku ps:scale are known as the dyno formation. These dynos do the app’s regular business (such as handling web requests and processing background jobs) as it runs. When you wish to do one-off administrative or maintenance tasks for the app, or execute some task periodically using Heroku Scheduler, you can spin up a one-off dyno.
Add Ons
Postgres
- DB info dashboard -> <APPLICATION> -> Resources
Operation
Delete Application
heroku apps:destroy uweheuer-capstone
Logging
heroku logs --tail
Example
Official Tutorial
PS C:\Temp\python-getting-started> heroku login
- clone example
- create app and push code
- start the app
PS C:\Temp\python-getting-started> heroku ps:scale web=1 Scaling dynos... done, now running web at 1:Free PS C:\Temp\python-getting-started> heroku open // opens https://arcane-peak-78109.herokuapp.com/
- open the dashboard
- stop it or scale it down to 0
heroku ps:scale web=0
- prepare for running locally
PS C:\Temp\python-getting-started> python -m venv venv PS C:\Temp\python-getting-started> .\venv\Scripts\activate (venv) PS C:\Temp\python-getting-started> pip install -r .\requirements.txt
- run it locally
(venv) PS C:\Temp\python-getting-started> python manage.py collectstatic (venv) PS C:\Temp\python-getting-started> heroku local -f .\Procfile.windows
- open it http://localhost:5000/