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
def __init__(self): # don't call super.__init__ self._cookies = {} self.application = _O(settings=dict(cookie_secret='0123456789'))
def __init__(self): # don't call super.__init__ self._cookies = {} self.application = _O(settings=dict(cookie_secret="0123456789"))
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):
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_)
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_)