Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> Python

Deploy โมดูล Python บน Heroku

สมมติ: Python 3.6, Pipenv, Heroku CLI ติดตั้งและ Login แล้ว

1. ต้องมี Git Repo

$ cd my-project
$ heroku create
Creating lit-bastion-5032... done
https://lit-bastion-5032.herokuapp.com/ | https://git.heroku.com/lit-bastion-5032.git

2. Push Code Deploy

$ git push heroku master
# Heroku Detect Python App
# Install Python, Pipenv, Dependencies from Pipfile.lock
# Run collectstatic (Django)
# Launch

3. Requirements (Pipfile / requirements.txt)

Flask==0.8
Jinja2==2.6
Werkzeug==0.8.3
certifi==0.0.8
chardet==1.0.1

Procfile (สำหรับ Web App)

web: gunicorn myapp:app
อ่านเพิ่ม: Heroku Python Support | Getting Started with Python on Heroku