from quixote.publish import Publisher
from quixote.directory import Directory, export
class RootDirectory(Directory):
@export(name='')
def index(self):
return '''<html>
<body>Welcome to the Quixote demo. Here is a
<a href="hello">link</a>.
</body>
</html>
'''
@export
def hello(self):
return '<html><body>Hello world!</body></html>'
def create_publisher():
return Publisher(RootDirectory(),
display_exceptions='plain')
if __name__ == '__main__':
from quixote.server.simple_server import run
print('creating demo listening on http://localhost:8080/')
run(create_publisher, host='localhost', port=8080)