def main(): enable_pretty_logging() read_configuration_and_options() # here the webserver gets created application = get_main_application(options=options) http_server = anzu.httpserver.HTTPServer(application, xheaders=True) http_server.listen(options.port) # (threads and co-processes get started here) processes = [] p = Process(target=wallet_synchronization, args=(application._db, )) p.start() processes.append(p) # ... and started try: anzu.ioloop.IOLoop.instance().start() except KeyboardInterrupt: pass # end all threads or coprocesses for process in processes: if process.is_alive(): process.terminate() process.join()
def main(): enable_pretty_logging() # These two lines are the difference. By them translations are loaded. cwd = os.path.dirname(__file__) anzu.locale.load_gettext_translations(os.path.join(cwd, "locales"), "messages") # here is nothing special anzu.options.parse_command_line() application = anzu.web.Application() http_server = anzu.httpserver.HTTPServer(application) http_server.listen(options.port) anzu.ioloop.IOLoop.instance().start()
from datetime import datetime from os import getlogin, makedirs, path, utime import codecs import logging import re import time import MySQLdb as mdb import pytz import yaml from anzu.escape import xhtml_unescape from anzu.options import parse_command_line, enable_pretty_logging from export_helper import get_page, get_part_of_page, get_gravatar_for enable_pretty_logging() parse_command_line() GMT = pytz.timezone('GMT') # current user/system timezone build_tz = pytz.timezone(time.strftime("%Z", time.gmtime())) plugin = re.compile(r'\[\w') print("MySQL connection data.") mysql_conn = { 'host': input(" host [localhost]: ") or "localhost", 'db': input(" database [%s_blog]: " % getlogin()) or getlogin() + "_blog", 'user': input(" mysql username [%s]: " % getlogin()) or getlogin(), 'passwd': input(" password: "******" table prefix [wp_]: ") or "wp_"
import time import MySQLdb as mdb import yaml import pytz from anzu.options import parse_command_line, enable_pretty_logging from anzu.escape import xhtml_unescape from export_helper import get_page, get_part_of_page, get_gravatar_for try: from collections import OrderedDict except: from thot.utils import OrderedDict enable_pretty_logging() parse_command_line() list_type = type([]) GMT = pytz.timezone('GMT') # current user/system timezone build_tz = pytz.timezone(time.strftime("%Z", time.gmtime())) plugin = re.compile(r'\[\w') print "MySQL connection data." mysql_conn = { 'host': raw_input(" host [localhost]: ") or "localhost", 'db': raw_input(" database [%s_blog]: " % getlogin()) or getlogin()+"_blog", 'user': raw_input(" mysql username [%s]: " % getlogin()) or getlogin(), 'passwd': raw_input(" password: ") or None, }