本文整理汇总了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))
示例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()