web2pyを使う
けっこう前から気になっていたpython版のweb framework,web2pyを使ってみようと思います.
いちおう公式ソースは1.99.4なんだけど,PyPiだと1.98.2.
でもとりあえずpipでインストールする.
$ pip install web2py Downloading/unpacking web2py Downloading web2py-1.98.2.tar.gz (4.7Mb): 4.7Mb downloaded Running setup.py egg_info for package web2py Installing collected packages: web2py Running setup.py install for web2py changing mode of build/scripts-2.6/w2p_apps from 664 to 775 changing mode of build/scripts-2.6/w2p_run from 664 to 775 changing mode of build/scripts-2.6/w2p_clone from 664 to 775 changing mode of /home/user/.virtualenvs/envname/bin/w2p_clone to 775 changing mode of /home/user/.virtualenvs/envname/bin/w2p_apps to 775 changing mode of /home/user/.virtualenvs/envname/bin/w2p_run to 775 Successfully installed web2py Cleaning up...
滞りなく終了!
んでいろいろ探してみるとweb2py_cloneだったり,mkweb2pyenvだったり.*1
いろいろ実行ファイルの名前かわってらっしゃるのかしら…
とりあえず現在はw2p_cloneを使う.
w2p_cloneのドキュメントを見てみる.
""" Author: Christopher Steel on behalf of Voice of Access Copyright: Copyrighted (c) by Massimo Di Pierro (2007-2011) web2py_clone becomes part of the web2py distribution available on Pypi via 'pip install web2py' web2py_clone is one of multiple commands that become available after running 'pip install web2py' in a virtual environment. It requires mercurial to be installed in the virtual environment. web2py_clone creates a local clone from the Web2py google code project in the directory "./web2py," a directory called web2py one directory up from the location of this script. ./bin/web2py_clone ./web2py """
ヘー (´・∀・`)
mercurialってのは分散バージョン管理システム.Gitみたいなもんか.
w2p_cloneの中身はここにある.
w2p_clone -
web2py -
Enterprise Web Framework - Google Project Hosting
.virtualenv/(name)/配下にweb2pyをぶちこむだけのスクリプトですた.あとhgに登録.
とりあえずmercurial入れてw2p_clone実行.
$ yum install hg $ w2p_clone cwd now: /home/user/envname cwd now: /home/user/.virtualenvs/envname/bin attempting to clone https://code.google.com/p/web2py/ to ../web2py requesting all changes adding changesets adding manifests adding file changes added 2833 changesets with 8161 changes to 1257 files updating to branch default 752 files updated, 0 files merged, 0 files removed, 0 files unresolved
いいかんじ〜
んで以下のコマンドでサーバ起動.
$ python ~/.virtualenvs/envname/web2py/web2py.py --nogui --password=test web2py Web Framework Created by Massimo Di Pierro, Copyright 2007-2011 Version 1.99.4 (2011-12-31 14:37:01) stable Database drivers available: SQLite3, pymysql Starting hardcron... please visit: http://127.0.0.1:8000 use "kill -SIGTERM 2082" to shutdown the web2py server
オプションはGUIなしと,パスワード指定です.
TK libraryなるものを入れていればGUIで起動できるのかな.
んでここで気づいたけどversionが最新版の1.99.4.
PyPiでは1.98.2なのに?
これについては次のエントリで.
*1:[http://markmail.org/message/oias744f7sr7atgj:title]