ラズベリーパイ+pythonを使ってみる – かんたんなwebアプリがパパっと作れる flask のインストール –

スポンサーリンク

flask(フラスク)=pythonでよく使われているwebアプリケーションフレームワークです。PHPでいうところのCakePHPをもっとかんたんにした感じです。RubyでいうとSinatraです

インストール

sudo pip install flask

ログ

sudo pip install flask
Downloading/unpacking flask
  Downloading Flask-0.10.1.tar.gz (544Kb): 544Kb downloaded
  Running setup.py egg_info for package flask

    warning: no files found matching '*' under directory 'tests'
    warning: no previously-included files matching '*.pyc' found under directory 'docs'
    warning: no previously-included files matching '*.pyo' found under directory 'docs'
    warning: no previously-included files matching '*.pyc' found under directory 'tests'
    warning: no previously-included files matching '*.pyo' found under directory 'tests'
    warning: no previously-included files matching '*.pyc' found under directory 'examples'
    warning: no previously-included files matching '*.pyo' found under directory 'examples'
    no previously-included directories found matching 'docs/_build'
    no previously-included directories found matching 'docs/_themes/.git'
Downloading/unpacking Werkzeug>=0.7 (from flask)
  Downloading Werkzeug-0.9.4.tar.gz (1.1Mb): 1.1Mb downloaded
  Running setup.py egg_info for package Werkzeug

    warning: no files found matching '*' under directory 'werkzeug/debug/templates'
    warning: no files found matching '*' under directory 'tests'
    warning: no previously-included files matching '*.pyc' found under directory 'docs'
    warning: no previously-included files matching '*.pyo' found under directory 'docs'
    warning: no previously-included files matching '*.pyc' found under directory 'tests'
    warning: no previously-included files matching '*.pyo' found under directory 'tests'
    warning: no previously-included files matching '*.pyc' found under directory 'examples'
    warning: no previously-included files matching '*.pyo' found under directory 'examples'
    no previously-included directories found matching 'docs/_build'
Requirement already satisfied (use --upgrade to upgrade): Jinja2>=2.4 in /usr/local/lib/python2.7/dist-packages (from flask)
Downloading/unpacking itsdangerous>=0.21 (from flask)
  Downloading itsdangerous-0.23.tar.gz (46Kb): 46Kb downloaded
  Running setup.py egg_info for package itsdangerous

    warning: no previously-included files matching '*' found under directory 'docs/_build'
Requirement already satisfied (use --upgrade to upgrade): markupsafe in /usr/local/lib/python2.7/dist-packages (from Jinja2>=2.4->flask)
Installing collected packages: flask, Werkzeug, itsdangerous
  Running setup.py install for flask

    warning: no files found matching '*' under directory 'tests'
    warning: no previously-included files matching '*.pyc' found under directory 'docs'
    warning: no previously-included files matching '*.pyo' found under directory 'docs'
    warning: no previously-included files matching '*.pyc' found under directory 'tests'
    warning: no previously-included files matching '*.pyo' found under directory 'tests'
    warning: no previously-included files matching '*.pyc' found under directory 'examples'
    warning: no previously-included files matching '*.pyo' found under directory 'examples'
    no previously-included directories found matching 'docs/_build'
    no previously-included directories found matching 'docs/_themes/.git'
  Running setup.py install for Werkzeug

    warning: no files found matching '*' under directory 'werkzeug/debug/templates'
    warning: no files found matching '*' under directory 'tests'
    warning: no previously-included files matching '*.pyc' found under directory 'docs'
    warning: no previously-included files matching '*.pyo' found under directory 'docs'
    warning: no previously-included files matching '*.pyc' found under directory 'tests'
    warning: no previously-included files matching '*.pyo' found under directory 'tests'
    warning: no previously-included files matching '*.pyc' found under directory 'examples'
    warning: no previously-included files matching '*.pyo' found under directory 'examples'
    no previously-included directories found matching 'docs/_build'
  Running setup.py install for itsdangerous

    warning: no previously-included files matching '*' found under directory 'docs/_build'
Successfully installed flask Werkzeug itsdangerous
Cleaning up...

使い方は、検索すると出てくるかと思います

pythonが動くのが遅いなぁ…という場合は

ラズベリーパイのCPUを高速にすることはできませんが、高速なさくらのVPSを借りてそれにUbuntuをインストールすることで、ラズベリーパイとほぼ同じ手順で高速なサーバを構築することができます(^O^)

自分も使っていますが、CPUはラズベリーパイのおよそ10倍速いのでブログソフトWordpressもサクサク動いてとても快適です(・∀・)
ラズベリーパイでサーバ構築の練習をし、VPSで高速安定なサーバを構築するとCPUやメモリも自由に使え、勉強する時間も少なく安定したサーバが作れるためコスパが最高だと思います


それかメモリ1ギガで月490円のDTIのVPSだと、ラズベリーパイ+SDカード+電源をそろえる5000円で10ヶ月はVPSが使えるので、wordpressを使ってブログの「運用」まで考えるならVPSの方がいいです