This is a sample python app for Heroku that executes using cronjob ( schuedling ) without using any external resources required like using weblink.
I prefer to use a free Addon named Heroku Scheduler
https://elements.heroku.com/addons/scheduler
Make sure you have Python 3 and the Heroku CLI installed.
- Fork this repo.
- Modify the file
code.py
according to your need. - Create a virtual environment for your app.
py -m venv venv-name-here
. - Activate that virtual environment.
- Install all required libraries for your python app in that environment.
- Replace the link of repo in
app.json
insiderepository
. - Run the script
pip freeze > requirements.txt
. - Commit and push the code.
- Star this repo if that helped you 😊.
$ heroku create
$ git push heroku main
$ heroku run python code.py
or
For more information about using Python on Heroku, see these Dev Center articles: