Skip to content

Build & Deploy A Python Web App To Automate Twitter | Flask, Heroku, Twitter API & Google Sheets API

Build & Deploy a Python web app to schedule Tweets. I'm using Flask, Heroku, the Twitter API, and Google Sheets API for this. You can watch how I build this app step by step from zero to deployment!


Build & Deploy a Python web app to schedule Tweets. I'm using Flask, Heroku, the Twitter API, and Google Sheets API for this. You can watch how I build this app step by step from zero to deployment! The app can be hosted for free then.

You can find the starting point for this tutorial on GitHub.

Technology we will be using

Flask Quickstart:

Create virtual env

python3 -m venv venv
Activate (on Mac):
. venv/bin/activate
pip install Flask
export FLASK_APP=app/main.py
flask run

Heroku start

heroku login -i
heroku create your_app_name

add config vars:

heroku config:set CONSUMER_KEY=xxx
heroku config:set CONSUMER_SECRET=xxx
heroku config:set ACCESS_TOKEN=xxx
heroku config:set ACCESS_SECRET=xxx
heroku config:set INTERVAL=1200
heroku config:set DEBUG=0

Scale worker:

heroku ps:scale worker=1

Test locally:

heroku local

Push to Heroku:

git init
heroku git:remote -a your_app_name
git add .
git commit -m "initial commit"
git push heroku master

and later your secret.json:

git checkout -b secret-branch
  --> remove secret.json from *.gitignore* on new branch
git add .
git commit -m "add credentials"
git push heroku secret-branch:master


FREE VS Code / PyCharm Extensions I Use

✅ Write cleaner code with Sourcery, instant refactoring suggestions: Link*


PySaaS: The Pure Python SaaS Starter Kit

🚀 Build a software business faster with pure Python: Link*

* These are affiliate link. By clicking on it you will not have any additional costs. Instead, you will support my project. Thank you! 🙏