#!/usr/bin/env python # -*- coding: utf-8 -*- from torngas.webserver import Server # import os """ run at gunicorn. gunicorn -c gunicorn.py.conf run_gunicorn:app torngas settings 写在gunicorn.conf.py中: os.environ.setdefault('TORNGAS_APP_SETTINGS', 'settings.setting') """ server = Server() server.parse_command() server.load_urls() app = server.load_application()
#!/usr/bin/env python # -*- coding: utf-8 -*- import os from torngas.webserver import Server PROJECT_OATH = os.path.dirname(os.path.abspath(__file__)) if __name__ == '__main__': os.environ.setdefault("SETTINGS_MODULE", "settings.setting") Server().runserver(PROJECT_OATH)
#!/usr/bin/env python # -*- coding: utf-8 -*- from torngas.webserver import Server """ run at gunicorn. gunicorn -c gunicorn.py.conf run_gunicorn:app torngas settings 写在gunicorn.conf.py中: os.environ.setdefault('TORNGAS_APP_SETTINGS', 'settings.setting') """ server = Server() server.parse_logger() server.load_urls() app = server.load_application()
import os from tornado.options import define, options from torngas.webserver import Server define("runmode", default='runserver', help='run mode, runserver|syncdb', type=str) os.environ.setdefault('TORNGAS_APP_SETTINGS', 'settings.setting') if __name__ == '__main__': """ If you want to quickly start the service , you can do like this: from torngas.webserver import run run() """ server = Server() server.parse_command() if options.runmode == 'syncdb': from helloworld.sync_db import syncdb syncdb() elif options.runmode == 'runserver': server.load_urls() server.load_application() server.load_httpserver() server.server_start() else: exit(0)
#!/usr/bin/env python # -*- coding: utf-8 -*- import os from tornado.options import options, parse_command_line from torngas.webserver import Server if __name__ == '__main__': parse_command_line() setting = options.settings if not setting: os.environ.setdefault('TORNGAS_APP_SETTINGS', 'settings.setting') if options.servermode == 'httpserver': server = Server() server.runserver() elif options.servermode == 'logserver': from torngas.logger.server import runserver runserver() else: print 'wrong servermode,please run python main.py --help'
from torngas.webserver import Server define("runmode", default='runserver', help='run mode, runserver|syncdb', type=str) os.environ.setdefault('TORNGAS_APP_SETTINGS', 'settings.setting') if __name__ == '__main__': """ If you want to quickly start the service , you can do like this: from torngas.webserver import run run() """ server = Server() server.parse_command() if options.runmode == 'syncdb': from helloworld.sync_db import syncdb syncdb() elif options.runmode == 'runserver': server.load_urls() server.load_application() server.server_start() else: exit(0)
别人笑我忒疯癫,我笑自己命太贱; 不见满街漂亮妹,哪个归得程序员? """ print code if __name__ == '__main__': """ start server: eg: python runserver.py --address=192.168.1.101 --port=8000 --settings=settings.prod --plat=ios If you want to quickly start the service , you can do like this: from torngas.webserver import run run() """ # 哈哈哈哈 pray_from_author() server = Server() server.parse_command() if options.runmode == 'runserver': server.init_app_config() server.load_urls() server.load_application() server.load_httpserver() server.server_start() else: exit(0)