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


Python Constants.init方法代码示例

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


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

示例1: main

# 需要导入模块: import Constants [as 别名]
# 或者: from Constants import init [as 别名]
def main():
    #init the constants first. Without that, you have nothing
    Constants.init()
    print("Printing from main: " + Constants.KeepDirectory)
    # first create our directory
    startTime = datetime.now()
    print('----------------- time now is ----------------------')
    print(startTime)
    print('----------------------------------------------------')
    print()
    print()
    _directoryWrapper = DirectoryWrapper.DirectoryWrapper()
    print('Creating the "Keep_Abstract" folder')
    _directoryWrapper.makeFolder("Keep_Abstract")
    print('writing out each file')
    _xmlTreeWrapper = XMLTreeWrapper.XMLTreeWrapper()
    _xmlTreeWrapper.writeXMLTree('List_of_150.txt')
    print('finished writing files')
    endTime = datetime.now()
    totaltime = endTime - startTime
    print('total time = ' + str(totaltime))
开发者ID:Wenugop,项目名称:abstract_project,代码行数:23,代码来源:main.py

示例2: define

# 需要导入模块: import Constants [as 别名]
# 或者: from Constants import init [as 别名]
from src.PageHandlers.ProductListHandler import ProductListHandler

define("port", default=Constants.get_site_port(), help="run on the given port", type=int)


class Application(tornado.web.Application):
    def __init__(self):
        handlers = [  # (?<=/)\w+
            (r"/products/(\w*)", ProductListHandler),
            (r"/order", OrderHandler)
        ]

        settings = dict(
            template_path=os.path.join(os.path.dirname(__file__), "templates"),
            static_path=os.path.join(os.path.dirname(__file__), "static"),
            cookie_secret='ABCD0912bZJc2sWbQLKos4156GkHn/VB9oXwQt8S0R0kRvJ5/xJ89E=',
            # xsrf_cookies=True,
            debug=Constants.DEBUG_ENABLED,
        )
        tornado.web.Application.__init__(self, handlers, **settings)


if __name__ == "__main__":
    print('server started...')
    Constants.init()
    # NOTE: start mongodb before run this web app
    tornado.options.parse_command_line()
    http_server = tornado.httpserver.HTTPServer(Application())
    http_server.listen(options.port)
    tornado.ioloop.IOLoop.instance().start()
开发者ID:uniblackfire,项目名称:meiqianzheng-backend,代码行数:32,代码来源:Main.py


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