#!/usr/bin/python from twisted.internet import defer, threads from twisted.internet import reactor from twisted.web import static, server import time import datetime import os import os.path import stat import twisted.web.resource import collections import random import json import text_server import datastore class TextResource(twisted.web.resource.Resource): lqueue = collections.deque() nqueue = collections.deque() isLeaf = False def __init__(self): import redis collection = datastore.RedisDataStore(redis.Redis()) twisted.web.resource.Resource.__init__(self) self.putChild('html', static.File('html')) self.putChild('js', static.File('js')) self.putChild('css', static.File('css')) cr = text_server.ChunkResource(collection) with open('data.txt') as f: cr.load_data('c1', f) self.putChild('texts', cr) def getChild(self, path, request): return self def render_GET(self, request): return 'asd'