コード例 #1
0
ファイル: main.py プロジェクト: yangkf1985/site-project
# -*- 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
ファイル: config.py プロジェクト: finalbattle/partner
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
ファイル: shortcuts.py プロジェクト: finalbattle/elo
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
ファイル: shortcuts.py プロジェクト: finalbattle/cloud-check
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)