Pylons
Framework do aplikacji webowych
Instalacja
apt-get install python-pylons apt-get install python-pylons
apt-get install python-pyramid apt-get install python-pyramid
apt-get install python-sqlalchemy apt-get install python-sqlalchemy
Paster
paster create -t pylons poczta paster create -t pylons poczta
paster controller manage.users paster controller manage.users
paster serve –reload development.ini paster serve –reload development.ini
paster setup-app development.ini paster setup-app development.ini
Uruchomienie
http://localhost:5000/controller_path/method http://localhost:5000/controller_path/method
Mako
<%def name="fun2(x)">
<%def name="fun2(x)">
fun2, x jest rowne ${x}fun2, x jest rowne ${x}
</%def>
</%def>
Mako
<%namespace name="comp"
<%namespace name="comp"
file="components.html" import=”*”/>
file="components.html" import=”*”/>
Mako
<%namespace name="hw"
<%namespace name="hw"
module="some.module"/>
module="some.module"/>
Przestrzenie nazw:
Przestrzenie nazw:
local local selfself
Mako
% if some_condition:
% if some_condition:
<%block>condition is met</%block><%block>condition is met</%block>
% endif
% endif
<%
<%
x = 10x = 10
%>
%>
Mako
Globalne zmienne Globalne zmienne cc – szablon – szablon
hh – pomoc – pomoc config
config request request
response response
session session urlurl
translator translator
Baza danych
./development.ini ./development.ini
sqlalchemy.url = sqlite:///%
sqlalchemy.url = sqlite:///%
(here)s/mydatabasefilename.sqlite (here)s/mydatabasefilename.sqlite
model/__init__.py
model/__init__.py – definicje modelu tworzone na – definicje modelu tworzone na starcie
starcie
model/meta.py
model/meta.py – przechowuje odpowiednie – przechowuje odpowiednie