当前位置: 首页>>代码示例>>Python>>正文


Python settings.DEBUG属性代码示例

本文整理汇总了Python中settings.DEBUG属性的典型用法代码示例。如果您正苦于以下问题:Python settings.DEBUG属性的具体用法?Python settings.DEBUG怎么用?Python settings.DEBUG使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在settings的用法示例。


在下文中一共展示了settings.DEBUG属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: backbone

# 需要导入模块: import settings [as 别名]
# 或者: from settings import DEBUG [as 别名]
def backbone(request):
    instance_name = instance_settings.SHORT_NAME
    instance_templates_base = join('instance_templates', instance_name)
    footer_template = join(instance_templates_base, 'footer.html')
    try:
        footer_content = render_to_string(footer_template)
    except:
        footer_content = ''
    context = {
        'site_title': instance_settings.SITE_TITLE,
        'app_base': instance_settings.APP_BASE,
        'footer': footer_content,
        'debug': settings.DEBUG
    }
    return render(request, "backbone.html", context)

#FIXME: move to models 
开发者ID:LibraryOfCongress,项目名称:gazetteer,代码行数:19,代码来源:views.py

示例2: get_settings

# 需要导入模块: import settings [as 别名]
# 或者: from settings import DEBUG [as 别名]
def get_settings():
    return {
        'debug': settings.DEBUG,
        'api_base': API_BASE,
        'app_base': APP_BASE,
        'osmUrl': OSM_URL,
        'osmAttrib': OSM_ATTRIBUTION,
        'centerLat': CENTER_LAT,
        'centerLon': CENTER_LON,
        'defaultZoom': DEFAULT_ZOOM,
        'smoothFactor': SMOOTH_FACTOR,
        'warperURLs': WARPER_URLS,
        'minYear': MIN_YEAR,
        'maxYear': MAX_YEAR,
        'origins': [origin.to_json() for origin in Origin.objects.all()],
        'featureCodes': get_feature_codes()
    } 
开发者ID:LibraryOfCongress,项目名称:gazetteer,代码行数:19,代码来源:helpers.py

示例3: check_prediction

# 需要导入模块: import settings [as 别名]
# 或者: from settings import DEBUG [as 别名]
def check_prediction(dictionary, threshold, gcm_device_id):
    sum_of_freq = sum(dictionary.values())
    max_tuple = max(dictionary.iteritems(), key=operator.itemgetter(1))

    percentage_freq = (max_tuple[1]) / sum_of_freq
    if percentage_freq >= threshold:
        candidate_string = max_tuple[0]
        dictionary.pop(candidate_string, None)

        if check_candidature(candidate_string):
            # send GCM message
            if DEBUG:
                print("{0} : successful candidate".format(candidate_string))
            else:
                gcm_send(gcm_device_id, candidate_string)

    return dictionary 
开发者ID:prabhakar267,项目名称:vertikin,代码行数:19,代码来源:utils.py

示例4: process_exception

# 需要导入模块: import settings [as 别名]
# 或者: from settings import DEBUG [as 别名]
def process_exception(request, exception):
        if request.path.startswith('/api'):
            exception_json = {'message': exception.message if hasattr(exception, 'message') else str(exception)}
            traceback_message = traceback.format_exc()
            logger.error(traceback_message)
            if DEBUG:
                    exception_json['traceback'] = traceback_message
            return create_json_response(exception_json, status=_get_exception_status_code(exception))
        return None 
开发者ID:macarthur-lab,项目名称:seqr,代码行数:11,代码来源:middleware.py

示例5: print_debug_level

# 需要导入模块: import settings [as 别名]
# 或者: from settings import DEBUG [as 别名]
def print_debug_level():
    if DEBUG:
        print "logging debug level is 'DEBUG'"
        logger.info("logging debug level is 'DEBUG'")
    else:
        print "logging debug level is 'INFO'"
        logger.info("logging debug level is 'INFO'") 
开发者ID:threathunterX,项目名称:sniffer,代码行数:9,代码来源:sniffer.py

示例6: init_sentry

# 需要导入模块: import settings [as 别名]
# 或者: from settings import DEBUG [as 别名]
def init_sentry():
    """
    init sentry
    :return:
    """
    from raven import Client
    from raven.handlers.logging import SentryHandler
    from raven.conf import setup_logging

    from complexconfig.configcontainer import configcontainer
    config = configcontainer.get_config("sniffer")

    enable = config.get_boolean("sniffer.sentry.enable", False)
    if not enable:
        return

    sentry_level = config.get_string("sniffer.sentry.min_level", "error")
    sentry_server_name = config.get_string("sniffer.sentry.server_name", "")
    sentry_dsn = config.get_string("sniffer.sentry.dsn", "")
    if not sentry_dsn or not sentry_server_name:
        return

    print_with_time("sentry is enabled with dsn: {}, server_name: {}, level: {}".format(sentry_dsn,
                                                                                        sentry_server_name,
                                                                                        sentry_level))
    client = Client(sentry_dsn, name=sentry_server_name)
    handler = SentryHandler(client)
    if sentry_level.lower() == 'debug':
        handler.level = logging.DEBUG
    elif sentry_level.lower() == 'info':
        handler.level = logging.INFO
    else:
        handler.level = logging.ERROR
    setup_logging(handler) 
开发者ID:threathunterX,项目名称:sniffer,代码行数:36,代码来源:sniffer.py

示例7: __init__

# 需要导入模块: import settings [as 别名]
# 或者: from settings import DEBUG [as 别名]
def __init__(self, database_path, input_sentence, language_path, thesaurus_path, json_output_path):
        database = Database()
        database.load(database_path)
        #database.print_me()

        config = LangConfig()
        config.load(language_path)

        parser = Parser(database, config)

        if thesaurus_path is not None:
            thesaurus = Thesaurus()
            thesaurus.load(thesaurus_path)
            parser.set_thesaurus(thesaurus)

        queries = parser.parse_sentence(input_sentence)

        if json_output_path is not None:
            self.remove_json(json_output_path)
            for query in queries:
                query.print_json(json_output_path)

        if(len(queries) > 1):
            if settings.DEBUG :
                print('--------- queries is more than one')
            self.query = None

            raise Exception('More than one query')
        else :
            self.query = queries[0]

        if settings.DEBUG :
            for query in queries:
                print query 
开发者ID:rupinder1133,项目名称:ln2sqlmodule,代码行数:36,代码来源:ln2sql.py

示例8: print_help_message

# 需要导入模块: import settings [as 别名]
# 或者: from settings import DEBUG [as 别名]
def print_help_message():
    if settings.DEBUG :
        print '\n'
        print 'Usage:'
        print '\tpython ln2sql.py -d <path> -l <path> -i <input-sentence> [-t <path>] [-j <path>]'
        print 'Parameters:'
        print '\t-h\t\t\tprint this help message'
        print '\t-d <path>\t\tpath to SQL dump file'
        print '\t-l <path>\t\tpath to language configuration file'
        print '\t-i <input-sentence>\tinput sentence to parse'
        print '\t-j <path>\t\tpath to JSON output file'
        print '\t-t <path>\t\tpath to thesaurus file'
        print '\n' 
开发者ID:rupinder1133,项目名称:ln2sqlmodule,代码行数:15,代码来源:ln2sql.py

示例9: add_primary_key

# 需要导入模块: import settings [as 别名]
# 或者: from settings import DEBUG [as 别名]
def add_primary_key(self, primary_key):
        if settings.DEBUG:
            print '%s : primary key added:%s' % (self.name, primary_key)
        self.primary_keys.append(primary_key) 
开发者ID:rupinder1133,项目名称:ln2sqlmodule,代码行数:6,代码来源:Table.py

示例10: add_foreign_key

# 需要导入模块: import settings [as 别名]
# 或者: from settings import DEBUG [as 别名]
def add_foreign_key(self, col, ref_table, ref_col):
        if settings.DEBUG:
            print 'foreign key added : %s.%s->%s.%s' % (self.name, col, ref_table, ref_col)
        self.foreign_keys.append({'col':col,'ref_table':ref_table,'ref_col':ref_col}) 
开发者ID:rupinder1133,项目名称:ln2sqlmodule,代码行数:6,代码来源:Table.py

示例11: finish_request

# 需要导入模块: import settings [as 别名]
# 或者: from settings import DEBUG [as 别名]
def finish_request(self, *args, **kwargs):
        try:
            BaseHTTPServer.HTTPServer.finish_request(self, *args, **kwargs)
        except Exception:
            if DEBUG:
                traceback.print_exc() 
开发者ID:stamparm,项目名称:tsusen,代码行数:8,代码来源:httpd.py

示例12: finish

# 需要导入模块: import settings [as 别名]
# 或者: from settings import DEBUG [as 别名]
def finish(self):
        try:
            BaseHTTPServer.BaseHTTPRequestHandler.finish(self)
        except Exception:
            if DEBUG:
                traceback.print_exc() 
开发者ID:stamparm,项目名称:tsusen,代码行数:8,代码来源:httpd.py

示例13: create_app

# 需要导入模块: import settings [as 别名]
# 或者: from settings import DEBUG [as 别名]
def create_app(loop):
    app = web.Application(loop=loop, debug=settings.DEBUG)
    setup_jinja(app, settings.DEBUG)
    aiohttp_session.setup(app, EncryptedCookieStorage(
        settings.SESSION_SECRET.encode('utf-8'),
        max_age=settings.SESSION_MAX_AGE))
    app.middlewares.append(aiohttp_login.flash.middleware)

    app.router.add_get('/', handlers.index)
    app.router.add_get('/users/', handlers.users, name='users')

    app['db'] = await asyncpg.create_pool(dsn=settings.DATABASE, loop=loop)
    aiohttp_login.setup(app, AsyncpgStorage(app['db']), settings.AUTH)

    return app 
开发者ID:imbolc,项目名称:aiohttp-login,代码行数:17,代码来源:app.py

示例14: set_default_headers

# 需要导入模块: import settings [as 别名]
# 或者: from settings import DEBUG [as 别名]
def set_default_headers(self):
        self.set_header("X-Powered-By","PHP/6.6.6")
        self.set_header("Server","Apache/6.6.6")
        self.set_header("Date","EMM, 00 SB 2333 00:00:00 MMM")
        if DEBUG:
            self.set_header("Access-Control-Allow-Credentials","true")
            self.set_header("Access-Control-Allow-Origin","*") 
开发者ID:shad0w008,项目名称:Scanver,代码行数:9,代码来源:webserver.py

示例15: post

# 需要导入模块: import settings [as 别名]
# 或者: from settings import DEBUG [as 别名]
def post(self):
        """ 全局处理函数,传入json
            形式如下
                {'c':'action', 'd':{data}}
        """
        data = self._decryptdata()
        #self.session = MemorySession(data.get('t',None))
        act = data.get('c','')
        kvs = data.get('d',{})
        self.json = {}
        self.json['code'] = 200
        self.json['error'] = ''
        action = '_' + act + '_action'
        if hasattr(self,action):
            try:
                self.json['result'] = getattr(self,action)(kvs)
            except Exception as e:
                self.json['error'] = str(e)
                if DEBUG:
                    type,value,tb = sys.exc_info()
                    e = '\n'.join(set(traceback.format_exception(type,value,tb)))
                print(str(e))
                self.json['code'] = 500
        else:
            self.json['code'] = 404
            self.json['error'] = '找不到该方法'
        self.set_status(self.json['code'])
        self.write(self._encryptdata(self.json))
        self.finish() 
开发者ID:shad0w008,项目名称:Scanver,代码行数:31,代码来源:webserver.py


注:本文中的settings.DEBUG属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。