예제 #1
0
# -*- coding: utf-8 -*-

import myapp
from torweb.urls import url
from torweb.handlers import BaseHandler
from torweb.tmpl import get_environment

env = get_environment(myapp.__name__)


@url("/main")
class MainHandler(BaseHandler):
    def get(self):
        tmpl = env.get_template("main.html")
        data = {"name": "torweb"}
        return self.write(tmpl.render(**data))
예제 #2
0
import traceback

from torweb.urls import url
from torweb.tmpl import get_environment
from torweb.config import CONFIG as CONFIGURATION
from logging.config import dictConfig

settings_path = os.path.join(partner.base_path, "settings", "dev.yaml")
CONF = CONFIG = CONFIGURATION(settings_path)

dictConfig(yaml.load(open(settings_path, 'r')))
itornado = logging.getLogger("console")
logger = logging.getLogger("file")
iError = logging.getLogger("iError")

env = get_environment(partner.__name__)

# cache = partner.cache
def get_cache():
    from torweb.cache import MemcachedCache, NullCache
    from werkzeug.contrib.cache import RedisCache
    nullcache = NullCache()
    try:
        cache_servers = CONF('MEMCACHED')
        if cache_servers:
            cache = MemcachedCache(cache_servers)
    except KeyError:
        redis_cache_host = CONF("REDIS.HOST")
        redis_cache_port = CONF("REDIS.PORT")
        if redis_cache_host and redis_cache_port:
            cache = RedisCache(redis_cache_host, redis_cache_port)
예제 #3
0
from logging.config import dictConfig
import traceback

from torweb.urls import url
from torweb.tmpl import get_environment
from torweb.config import CONFIG as CONFIGURATION

settings_path = os.path.join(elo.base_path, "settings.yaml")
CONF = CONFIG = CONFIGURATION(settings_path)

dictConfig(yaml.load(open(settings_path, 'r')))
itornado = logging.getLogger("console")
logger = logging.getLogger("file")
iError = logging.getLogger("iError")

env = get_environment(elo.__name__)


# cache = elo.cache
def get_cache():
    from torweb.cache import MemcachedCache, NullCache
    from werkzeug.contrib.cache import RedisCache
    nullcache = NullCache()
    try:
        cache_servers = CONF('MEMCACHED')
        if cache_servers:
            cache = MemcachedCache(cache_servers)
    except KeyError:
        redis_cache_host = CONF("REDIS.HOST")
        redis_cache_port = CONF("REDIS.PORT")
        if redis_cache_host and redis_cache_port:
예제 #4
0
from logging.config import dictConfig
import traceback

from torweb.urls import url
from torweb.tmpl import get_environment
from torweb.config import CONFIG as CONFIGURATION

settings_path = os.path.join(elo.base_path, "settings.yaml")
CONF = CONFIG = CONFIGURATION(settings_path)

dictConfig(yaml.load(open(settings_path, 'r')))
itornado = logging.getLogger("console")
logger = logging.getLogger("file")
iError = logging.getLogger("iError")

env = get_environment(elo.__name__)

# cache = elo.cache
def get_cache():
    from torweb.cache import MemcachedCache, NullCache
    from werkzeug.contrib.cache import RedisCache
    nullcache = NullCache()
    try:
        cache_servers = CONF('MEMCACHED')
        if cache_servers:
            cache = MemcachedCache(cache_servers)
    except KeyError:
        redis_cache_host = CONF("REDIS.HOST")
        redis_cache_port = CONF("REDIS.PORT")
        if redis_cache_host and redis_cache_port:
            cache = RedisCache(redis_cache_host, redis_cache_port)
예제 #5
0
import scloud
import os
import yaml
import logging
from logging.config import dictConfig
import traceback

from torweb.urls import Url
from torweb.tmpl import get_environment
from scloud.config import CONF, logger
from scloud.utils.error_code import ERROR as ERR
from tornado.web import Application
# from torweb.application import reverse_url
# from torweb.application import make_application

env = get_environment(scloud.__name__)
from scloud.utils.filters import Filters
Filters.init(env)

url = Url(CONF("URL_ROOT"))

# cache = scloud.cache
def get_cache():
    from torweb.cache import MemcachedCache, NullCache
    from werkzeug.contrib.cache import RedisCache
    nullcache = NullCache()
    try:
        cache_servers = CONF('MEMCACHED')
        if cache_servers:
            cache = MemcachedCache(cache_servers)
    except KeyError:
예제 #6
0
import scloud
import os
import yaml
import logging
from logging.config import dictConfig
import traceback

from torweb.urls import Url
from torweb.tmpl import get_environment
from scloud.config import CONF, logger
from scloud.utils.error_code import ERROR as ERR
from tornado.web import Application
# from torweb.application import reverse_url
# from torweb.application import make_application

env = get_environment(scloud.__name__)
from scloud.utils.filters import Filters
Filters.init(env)

url = Url(CONF("URL_ROOT"))


# cache = scloud.cache
def get_cache():
    from torweb.cache import MemcachedCache, NullCache
    from werkzeug.contrib.cache import RedisCache
    nullcache = NullCache()
    try:
        cache_servers = CONF('MEMCACHED')
        if cache_servers:
            cache = MemcachedCache(cache_servers)