**** File HelloServer.cfg **** [server] socketPort=80 [staticContent] static=/home/remi/static # Here I add my own configuration options [user] name=Remi [database] login=remiLogin password=remiPassword *** File Hello.cpy **** CherryClass Root: view: def index(self): <html><body> Hello, <py-eval="configFile.get('user','name')"><br> to connect to the database, you should use:<br> <py-eval="'Login:%s, Password:%s'%(configFile.get('database','login'), configFile.get('data base','password'))"> </body></html>This will be rendered as:
<html><body> Hello, Remi<br> to connect to the database, you should use:<br> Login:remiLogin, Password:remiPassword </body></html>
次の章では、CherryPyの特別な変数と、特別な関数について学ぶことにします。。。