プログラミング

シンプルに使い方を紹介

【Python】【Heroku】FlaskでWebアプリケーションを作成

$ pip install flask
$ pip install gunicorn
$ pip freeze > requirements.txt
$ echo 'web: gnicorn hello:app --log-file=-' > Procfile

hello.py

# -*- coding: utf-8 -*-

from flask import Flask
app = Flask(__name__)

@app.route('/')
def hello_world():
    return 'Hello World!'

if __name__ == '__main__':
    app.run()
$ git init
$ git add .
$ git commit -m"message"
$ heroku login
$ heroku create
$ git push heroku master
$ heroku open