Ejemplo n.º 1
0
def run_echo_server(port):
    from gevent.monkey import patch_all
    patch_all()
    import spa
    class Echo(spa.Handler):
        def websocket(self):
            while True:
                msg = self.ws.receive()
                self.ws.send(msg)
    routes = (
        ('/', 'echo', Echo),
    )

    app = spa.App(routes)
    spa.run(app, port=port)
Ejemplo n.º 2
0
import spa
from spa.static import StaticHandler

routes = (
    ('/', '', StaticHandler, {'directory': '.'}),
)
app = spa.App(routes)

spa.run(app)

# Now navigate to localhost:8000/simple_static.py and you should see this file
# served out to you.
Ejemplo n.º 3
0
def run_web():
    from mettle.web.green import patch
    patch()
    import spa
    from mettle.web import app
    spa.run(app)