def get_all_config(): import os, sys cur_dir = os.path.dirname(os.path.abspath(__file__)) + os.sep + os.pardir + os.sep # sys.path.insert(0, os.path.join(cur_dir, "..")) sys.path.append(os.path.join(cur_dir)) try: import game_config from models.config import Config as ConfigModel except: import settings settings.set_evn('dev_new', '1') # settings.set_evn('dev', 'h1') import game_config from models.config import Config as ConfigModel # from apps.config import game_config common_config_name_list = game_config.config_name_list # game_config_name_list = game_config.all_config_name_list config_dict = {} for config_key, config_sub_func, is_show_in_admin, is_modifable, xls_table_name, need_download, _ in game_config.config_name_list: _c = ConfigModel.get(config_key) config_dict[config_key] = _c.value filename = cur_dir + '/test/local_config.py' f = open(filename, 'w') d = str(config_dict) f.write('config='+d) f.close() return filename
import time import json import gevent import gevent.monkey gevent.monkey.patch_all() from gevent.wsgi import WSGIServer from lib.utils.debug import print_log import settings settings.set_evn('dev_new', 1) # set_evn('dev', 'h1') import handler_tools from views import gvg def get_user(uid): """# get_user: docstring args: uid: --- arg returns: 0 --- """ import game_config if not game_config.is_config_out():
import os, sys import signal import psutil import socket import time import datetime import traceback import gevent from gevent.server import StreamServer from gevent.pool import Pool import settings env = sys.argv[1] server_name = sys.argv[2] settings.set_evn(env, server_name) # (dev_new, 1) settings.ENVPROCS = 'chat' from lib.utils.debug import print_log from chat.client import Client, ClientManager from chat.content import ContentFactory from lib.utils.encoding import force_unicode, force_str from logics.user import User from tornado.options import define, options # HOST = settings.SERVERS[settings.SERVICE_NAME]['chat_ip'] PORT = settings.SERVERS[[s for s in settings.SERVERS if s != 'master'][0]]['chat_port'] # 简单获取本机ip
import sys import time import datetime import copy import gevent from gevent.event import Event from gevent.lock import RLock import settings env = sys.argv[1] server_name = sys.argv[2] CONFIG_TYPE = 1 if server_name == 'master' else int(server_name) settings.set_evn(env, server_name) settings.ENVPROCS = 'team_pk' from lib.utils.debug import print_log, trackback import game_config from models.timer import Timer from models.config import ConfigVersionManager from run_timer_script.timer_task import TimerTask from run_timer_script.timer_task_team_pk_do_group import TimerTaskTeamPkNewDoGroup from run_timer_script.timer_task_team_pk_select_player import TimerTaskTeamPkNewSelectPlayer from run_timer_script.timer_task_team_pk_new import TimerTaskTeamPkNew from run_timer_script.timer_task_team_pk_gift_and_score import TimerTaskTeamPkNewGiftAndScore # 需要更新的配置,需要写死
from tornado import web from tornado.options import define, options from tornado import autoreload import tornado define("port", default=8888, help="run on the given port", type=int) define("env", default='dev_new', help='the env', type=str) define("server_name", default='1', help='the server name', type=str) define("numprocs", default=2, help="process sum", type=int) define("debug", default=False, help="run at debug mode", type=bool) define("maxmem", default=0, help="max memory use, overflow kill by self. (0 unlimit)", type=int) options.parse_command_line() import settings settings.set_evn(options.env, options.server_name) settings.ENVPROCS = 'run' from handlers import APIRequestHandler from handlers import ConfigHandler from handlers import AdminHandler from handlers import Login from handlers import Pay, PayCallBack from handlers import AdClick from handlers import ZhiChong360Handler from handlers import CMGEHandler from handlers import AdvertHandler from lib.utils.debug import print_log
# -*- coding:utf-8 -*- import os from tornado.wsgi import WSGIApplication from tornado.options import options # 解析tornado启动参数, 设置日志debug级别 options.parse_command_line(['', '--logging=debug']) game_env = os.getenv('game_env') server_name = os.getenv('server_name') print 'game_env: %s, server_name: %s' % (game_env, server_name) import settings settings.set_evn(game_env, server_name) settings.ENVPROCS = 'wsgi' from handlers import APIRequestHandler from handlers import ConfigHandler from handlers import AdminHandler from handlers import Login from handlers import Pay, PayCallBack from handlers import AdClick from handlers import ZhiChong360Handler from handlers import CMGEHandler from handlers import AdvertHandler class Application(WSGIApplication): def __init__(self):