summaryrefslogtreecommitdiff
path: root/server2.py
blob: 5f9c32ebd2a96c0334d164628c0a4947815ca9e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
from klein import run, route
from twisted.internet.threads import deferToThread

from tasks import fib


@route('/')
def home(request):
    d = deferToThread(fib, 30)
    d.addCallback(lambda result: 'answer is >> %s' % result)
    return d

if __name__ == "__main__":
    run("localhost", 8080)