예제 #1
0
파일: config.py 프로젝트: daqing15/torn
def load_settings(user_settings):
    """ Parse user settings, imports local settings, etc. """
    try:
        import settings_local
        user_settings.update(settings_local.settings)
    except ImportError:
        pass

    settings = _O(user_settings)
    return settings
예제 #2
0
파일: config.py 프로젝트: nixon/torn
def load_settings(user_settings):
    """ Parse user settings, imports local settings, etc. """
    try:
        import settings_local
        user_settings.update(settings_local.settings)
    except ImportError:
        pass

    settings = _O(user_settings)
    return settings
예제 #3
0
 def __init__(self):
     # don't call super.__init__
     self._cookies = {}
     self.application = _O(settings=dict(cookie_secret='0123456789'))
예제 #4
0
파일: web_test.py 프로젝트: allanca/tornado
 def __init__(self):
     # don't call super.__init__
     self._cookies = {}
     self.application = _O(settings=dict(cookie_secret="0123456789"))
예제 #5
0
파일: server.py 프로젝트: yszou/AceTest
DB = settings.DATABASES
DB['default']['NAME'] = options.db
django_settings.configure(DATABASES = settings.DATABASES)

from django.db import connection, transaction
from Schema.models import Request, Category

#tornado.httpclient.AsyncHTTPClient.configure("tornado.curl_httpclient.CurlAsyncHTTPClient")
AsyncClient = tornado.httpclient.AsyncHTTPClient
Client = tornado.httpclient.HTTPClient

DEFAULT_HOST = 'http://localhost:8000'

#打到模板中去的函数
Funcs = _O({
    'uuid': uuid.uuid4,
})


class BaseHandler(tornado.web.RequestHandler):
    SUPPORTED_METHODS = ("GET", "POST", "DELETE", "PUT", 'SWITCH',
                         'SET_HOST', 'SET_PUB_HEADER')

    def initialize(self):
        '处理构建PUT和DELETE方法'

        _method = self.get_argument('_method', None)
        if self.request.method == 'POST' and _method:
            self.request.method = _method.upper()

    def finish(self, *args, **kargs):
예제 #6
0
from tornado.web import _O

settings_ = dict(
    admins=[
        'twit:nod',
        'twit:joshmarshall',
        'twit:bradevans137',
    ],
    debug=False,
    debug_pdb=False,
    httpd_port=5580,
    cookie_secret="replace this in local",
    xsrf_cookies=True,
    static_path=path.join(path.dirname(__file__), "static"),
    template_path=path.join(path.dirname(__file__), "templates"),
    twitter_consumer_key='cDM0snp8FEaOdr5Ii4IOg',
    twitter_consumer_secret='rIumSmLk4dmBpCAa9IZmEO9HnKnOlLeL9BH9Qc5CI',
    facebook_api_key='',
    facebook_secret='',
    login_url='/login',
)
# pull in our local overrides
try:
    from settings_local import settings_ as settings_local
    settings_.update(settings_local)
except ImportError:
    pass

# lastly, create our settings object
settings = _O(settings_)
예제 #7
0
파일: settings.py 프로젝트: nod/controll
    admins = [ 'twit:nod', 'twit:joshmarshall', 'twit:bradevans137', ],

    debug = False,
    debug_pdb = False,

    httpd_port = 5580,

    cookie_secret = "replace this in local",
    xsrf_cookies = True,

    static_path = path.join(path.dirname(__file__), "static"),
    template_path = path.join(path.dirname(__file__), "templates"),

    twitter_consumer_key = 'cDM0snp8FEaOdr5Ii4IOg',
    twitter_consumer_secret = 'rIumSmLk4dmBpCAa9IZmEO9HnKnOlLeL9BH9Qc5CI',

    facebook_api_key = '',
    facebook_secret = '',

    login_url = '/login',

    )
# pull in our local overrides
try:
    from settings_local import settings_ as settings_local
    settings_.update(settings_local)
except ImportError: pass

# lastly, create our settings object
settings = _O(settings_)