Help us understand the problem. What is going on with this article?

Python+Flask+Herokuで簡単webアプリ

More than 5 years have passed since last update.

あいさつ

Rubyからの視点で色々備忘を綴ります.

pip, pip3

gemみたいなやつ、

python3に同梱されているヤツはpip3

virtualenv

Bundlerみたいなやつ

$ pip3 install virtualenv

bundle init みたいなコマンドでisolatedな環境を作る

$ virtualenv venv

bundle exec みたいなコマンドを打つ

$ source venv/bin/activate

Flask

Sinatraみたいなやつ

$ pip install flask

Gunicorn

webサーバー、unicornみたいなやつ

$ pip install gunicorn

アプリを作り始める

test_appという名前だとします.

$ mkdir test_app; cd test_app


$ touch main.py Procfile
main.py
import os
from flask import Flask

app = Flask(__name__)

@app.route('/')
def index():
    return 'Hello World!'
Procfile
web: gunicorn main:app --log-file=-

起動

$ foreman start

簡単や...

Gemfile.lock的なものを作る

$ pip freeze > requirements.txt

git

$ git init

$ echo 'venv\n*.pyc' > .gitignore

heroku

$ heroku create test-app

$ git push heroku master

$ heroku open

あとは

http://flask.pocoo.org/docs/0.10/

gogotanaka
20台前半までRubyのコミッターになるくらいには死ぬほどプログラミングをした後、起業をし https://ticketjam.jp/ というサービスに打ち込んでいます。
http://gogotanaka.me/
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした