いいかげんeasy_installじゃなくてpipな環境整えろって話ですよ。
Goal
Junoをインストールして「Hello,りっちゃん」画面を出すとこまで。
Log
% cd % sudo easy_install juno Password: Searching for juno Reading http://pypi.python.org/simple/juno/ Best match: Juno 0.1.2 Downloading https://pypi.python.org/packages/source/J/Juno/Juno-0.1.2.tar.gz#md5=3266cf3a82cd6d48a5257b9a865c0da7 Processing Juno-0.1.2.tar.gz Running Juno-0.1.2/setup.py -q bdist_egg --dist-dir /tmp/easy_install-vzI6cY/Juno-0.1.2/egg-dist-tmp-N8BOLa ** SQLAlchemy is required by Juno ** Download from: http://sqlalchemy.org/download.html ** Or run: `easy_install SQLAlchemy` No eggs found in /tmp/easy_install-vzI6cY/Juno-0.1.2/egg-dist-tmp-N8BOLa (setup script problem?) # SQLAlchemyとな? % sudo easy_install SQLAlchemy Searching for SQLAlchemy Reading http://pypi.python.org/simple/SQLAlchemy/ Best match: SQLAlchemy 0.8.2 Downloading https://pypi.python.org/packages/source/S/SQLAlchemy/SQLAlchemy-0.8.2.tar.gz#md5=5a33fb43dea93468dbb2a6562ee80b54 Processing SQLAlchemy-0.8.2.tar.gz Running SQLAlchemy-0.8.2/setup.py -q bdist_egg --dist-dir /tmp/easy_install-5mYI4w/SQLAlchemy-0.8.2/egg-dist-tmp-SJHrZ9 warning: no files found matching '*.jpg' under directory 'doc' no previously-included directories found matching 'doc/build/output' zip_safe flag not set; analyzing archive contents... Adding SQLAlchemy 0.8.2 to easy-install.pth file Installed /Library/Python/2.7/site-packages/SQLAlchemy-0.8.2-py2.7-macosx-10.7-intel.egg Processing dependencies for SQLAlchemy Finished processing dependencies for SQLAlchemy # 入ったぽい。気を取り直して % sudo easy_install juno Searching for juno Reading http://pypi.python.org/simple/juno/ Best match: Juno 0.1.2 Downloading https://pypi.python.org/packages/source/J/Juno/Juno-0.1.2.tar.gz#md5=3266cf3a82cd6d48a5257b9a865c0da7 Processing Juno-0.1.2.tar.gz Running Juno-0.1.2/setup.py -q bdist_egg --dist-dir /tmp/easy_install-VD1IJ9/Juno-0.1.2/egg-dist-tmp-bjxxez ** SQLAlchemy is required by Juno ** Download from: http://sqlalchemy.org/download.html ** Or run: `easy_install SQLAlchemy` No eggs found in /tmp/easy_install-VD1IJ9/Juno-0.1.2/egg-dist-tmp-bjxxez (setup script problem?) # ふぁっ!? # pip入れてpipでやってみっか % sudo easy_install pip Searching for pip Reading http://pypi.python.org/simple/pip/ Best match: pip 1.3.1 Downloading https://pypi.python.org/packages/source/p/pip/pip-1.3.1.tar.gz#md5=cbb27a191cebc58997c4da8513863153 Processing pip-1.3.1.tar.gz Running pip-1.3.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-h2hE8p/pip-1.3.1/egg-dist-tmp-lF4krf warning: no files found matching '*.html' under directory 'docs' warning: no previously-included files matching '*.txt' found under directory 'docs/_build' no previously-included directories found matching 'docs/_build/_sources' Adding pip 1.3.1 to easy-install.pth file Installing pip script to /usr/local/bin Installing pip-2.7 script to /usr/local/bin Installed /Library/Python/2.7/site-packages/pip-1.3.1-py2.7.egg Processing dependencies for pip Finished processing dependencies for pip % which pip /usr/local/bin/pip # pipは入っとるな # じゃ気を取り直して、pipでjunoを入れてみよう % sudo pip install juno Downloading/unpacking juno Downloading Juno-0.1.2.tar.gz Running setup.py egg_info for package juno ** To use SCGI and FastCGI, Juno requires flup ** Download from: http://wiki.pylonshq.com/display/beaker/Home ** Or run: `easy_install Beaker` ** If you're not going to use sessions, ignore this message. ** To use the middleware debugger, Juno requires Werkzeug ** Download from: http://dev.pocoo.org/projects/werkzeug ** Or run: `easy_install Werkzeug` ** If you're not going to use the debugger, ignore this message. Installing collected packages: juno Running setup.py install for juno ** To use SCGI and FastCGI, Juno requires flup ** Download from: http://trac.saddi.com/flup/ ** If you're not going to use SCGI or FastCGI, ignore this message ** Juno uses Jinja2 or Mako templates by default ** Using another template library will require additional configuration ** Download from: http://pypi.python.org/pypi/Jinja2 ** or from: http://pypi.python.org/pypi/Mako ** Alternatively: `easy_install Jinja2` ** and: `easy_install Mako` ** Beaker is used for Juno's session management ** Download from: http://wiki.pylonshq.com/display/beaker/Home ** Or run: `easy_install Beaker` ** If you're not going to use sessions, ignore this message. ** To use the middleware debugger, Juno requires Werkzeug ** Download from: http://dev.pocoo.org/projects/werkzeug ** Or run: `easy_install Werkzeug` ** If you're not going to use the debugger, ignore this message. Successfully installed juno Cleaning up... % # 入った的な雰囲気出とるな
確認
% python Python 2.7.1 (r271:86832, Jun 16 2011, 16:59:05) [GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import juno >>> from juno import * >>> exit()
いけてるっぽい
りっちゃんお!
app.pyを書く
# -*- coding: utf-8 -*- from juno import * @route('/') def index(web): return '<h1>Hello, りっちゃん!!</h1><img src="http://oti10.com/public/src/favicon.jpg">' run()
さあ起動
% python app.py Traceback (most recent call last): File "app.py", line 4, in <module> @route('/') File "/Library/Python/2.7/site-packages/juno.py", line 443, in route if _hub is None: init() File "/Library/Python/2.7/site-packages/juno.py", line 413, in init _hub = Juno(configuration) File "/Library/Python/2.7/site-packages/juno.py", line 71, in __init__ self.setup_templates() File "/Library/Python/2.7/site-packages/juno.py", line 106, in setup_templates import jinja2 ImportError: No module named jinja2
(; ・`д・´) jinja2 ???
% sudo pip install jinja2 Downloading/unpacking jinja2 Downloading Jinja2-2.7.tar.gz (377kB): 377kB downloaded Running setup.py egg_info for package jinja2 warning: no files found matching '*' under directory 'custom_fixers' warning: no previously-included files matching '*' found under directory 'docs/_build' warning: no previously-included files matching '*.pyc' found under directory 'jinja2' warning: no previously-included files matching '*.pyc' found under directory 'docs' warning: no previously-included files matching '*.pyo' found under directory 'jinja2' warning: no previously-included files matching '*.pyo' found under directory 'docs' Downloading/unpacking markupsafe (from jinja2) Downloading MarkupSafe-0.18.tar.gz Running setup.py egg_info for package markupsafe Installing collected packages: jinja2, markupsafe Running setup.py install for jinja2 warning: no files found matching '*' under directory 'custom_fixers' warning: no previously-included files matching '*' found under directory 'docs/_build' warning: no previously-included files matching '*.pyc' found under directory 'jinja2' warning: no previously-included files matching '*.pyc' found under directory 'docs' warning: no previously-included files matching '*.pyo' found under directory 'jinja2' warning: no previously-included files matching '*.pyo' found under directory 'docs' Running setup.py install for markupsafe building 'markupsafe._speedups' extension llvm-gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c markupsafe/_speedups.c -o build/temp.macosx-10.7-intel-2.7/markupsafe/_speedups.o llvm-gcc-4.2 -Wl,-F. -bundle -undefined dynamic_lookup -Wl,-F. -arch i386 -arch x86_64 build/temp.macosx-10.7-intel-2.7/markupsafe/_speedups.o -o build/lib.macosx-10.7-intel-2.7/markupsafe/_speedups.so Successfully installed jinja2 markupsafe Cleaning up... # あ、なんか入ったw
では気を取り直して
% python app.py running Juno development server, <C-c> to exit... connect to 127.0.0.1:8000 to use your app...
お。ではブラウザでlocalhost:8000にアクセスすっと...
そのころサーバ側のコンソールでは...
GET request for /... / matches, calling index()...
動的ルーティングも簡単そうだし。いい感じ。
memo
TODO : what is jinja2 ?
りっちゃんかわいいです