Ubuntu設定からHerokuでPythonのTwitter Bot作成

# heroku cli インストール
sudo add-apt-repository "deb https://cli-assets.heroku.com/branches/stable/apt ./"
curl -L https://cli-assets.heroku.com/apt/release.key | sudo apt-key add -
sudo apt update

sudo apt install heroku

# python3.6インストール
sudo add-apt-repository ppa:fkrull/deadsnakes
sudo apt update
sudo apt install python3.6

wget https://bootstrap.pypa.io/ez_setup.py
sudo -H python3.6 ez_setup.py

# pipインストール
wget https://bootstrap.pypa.io/get-pip.py
sudo -H python3.6 get-pip.py

python3.6 -m pip install --user pipenv

pipenv --python 3.6

# 3.6だとエラーがでるので3.5をメインにする
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.5 2
sudo update-alternatives --config python3


heroku login

cd tamagawa

pipenv install python-twitter
pipenv install html5lib
pipenv install beautifulsoup4
pipenv install apscheduler

pipenv run pip freeze > requirements.txt
echo "python-3.6.2" > runtime.txt
echo "clock: python clock.py" > Procfile

git config --global user.name hogehoge
git config --global user.email xxxxxx@gmail.com

rm -rf .git

git init
git add .
git commit -m "my first commit"

heroku create hogehoge

git push heroku master

heroku config:set CONSUMER_KEY="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
heroku config:set CONSUMER_SECRET="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
heroku config:set ACCESS_TOKEN_KEY="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
heroku config:set ACCESS_TOKEN_SECRET="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

heroku config:add TZ=Asia/Tokyo

heroku ps:scale clock=1

Python3

devcenter.heroku.com

How to Install Python 3.6.1 in Ubuntu 16.04 LTS | UbuntuHandbook

www.python.jp

pipenv

qiita.com

utgwkk.hateblo.jp

heroku

qiita.com

hwhw.hatenablog.com

review-of-my-life.blogspot.jp

qiita.com

devcenter.heroku.com

github.com

azuuun-memorandum.hatenablog.com