| ページ一覧 | ブログ | twitter |  書式 | 書式(表) |

MyMemoWiki

差分

ナビゲーションに移動 検索に移動
48 バイト追加 、 2020年2月16日 (日) 04:30
編集の要約なし
==[[Pyramid]]==
[[Python]] | [[Django]] |
*http://docs.pylonsproject.jp/projects/pyramid-doc-ja/en/latest/index.html
==導入==
* [[Python ]] のパッケージ管理 setuptools を導入しておく===VirtualEnvを利用してPythonの仮想環境を作成VirtualEnvを利用して[[Python]]の仮想環境を作成===
=====インストール=====
c:\easy_install virtualenv[[vi]]rtualenv
=====ワークスペースの作成=====
c:\work\python>virtualenv [[vi]]rtualenv --no-site-package env
New python executable in env\Scripts\python.exe
Installing setuptools................done.
c:\work\python\env\Scripts>activate
(env) c:\work\python\env\Scripts>
===Pyramidのインストール[[Pyramid]]のインストール===
=====ワークスペースに移動=====
(env) c:\work\python\env\Scripts>cd ..
=====Pyramidのインストール[[Pyramid]]のインストール=====
(env) c:\work\python\env>easy_install pyramid
Searching for pyramid
Reading [[R]]eading http://pypi.python.org/simple/pyramid/ Reading [[R]]eading http://docs.pylonshq.com
 :
===Hello World===
from wsgiref.simple_server import make_server
from pyramid.config import Configurator
from pyramid.response import Response[[R]]esponse
def hello_world(request):
return Response[[R]]esponse('Hello %(name)s!' % request.matchdict)
if __name__ == '__main__':
config = Configurator()
config.add_route('hello', '/hello/{name}')
config.add_viewadd_[[vi]]ew(hello_world, route_name='hello')
app = config.make_wsgi_app()
server = make_server('0.0.0.0', 8080, app)

案内メニュー