diff --git a/examples/cherry_hello_world.py b/examples/cherry_hello_world.py index 9466182..51d80d7 100644 --- a/examples/cherry_hello_world.py +++ b/examples/cherry_hello_world.py @@ -4,7 +4,10 @@ import cherrypy class HelloWorld(object): @cherrypy.expose def index(self): - return "Hello World!" + with open('./templates/index.html') as fh: + index_f = fh.read() + result = index_f.format(_title='Nazev_stranky', _nadpis='Cokoliv!') + return result cherrypy.quickstart(HelloWorld()) diff --git a/examples/chttpd.py b/examples/chttpd.py index 814443b..5e1d4b4 100755 --- a/examples/chttpd.py +++ b/examples/chttpd.py @@ -28,7 +28,7 @@ def main_server_loop(): *Exception* If server is unable to start ''' - server_config={ + server_config = { 'server.socket_host': '127.0.0.1', 'server.socket_port': 80 } diff --git a/examples/modules/index.py b/examples/modules/index.py index f15468e..701e7e5 100644 --- a/examples/modules/index.py +++ b/examples/modules/index.py @@ -1,6 +1,6 @@ #!/usr/bin/python3 import cherrypy -import config +import json static_dir = '/templates/' # Needs to have trailing and leading slash '/' @@ -8,5 +8,37 @@ class wellcome(object): '''Base Index constructor and expose function''' @cherrypy.expose def index(self): - result = '