# coding:utf-8 from admin import app from admin import webadmin app.register_blueprint(webadmin, url_prefix='/admin') from admin.models import User, db if __name__ == '__main__': app.run()
from admin import app from admin.data import build_sample_db import os import os.path as op # Build a sample db on the fly, if one does not exist yet. app_dir = op.join(op.realpath(os.path.dirname(__file__)), 'admin') database_path = op.join(app_dir, app.config['DATABASE_FILE']) if not os.path.exists(database_path): build_sample_db() # Start app app.run(debug=True)
#-*- coding:utf-8 -*- import os from admin import app #app.run(port=80) if __name__ == "__main__": app.run()
from admin import app import default_config app.config.from_object(default_config) try: import config app.config.from_object(config) except ImportError: pass from common import login app.register_blueprint(login.blueprint) if __name__ == "__main__": app.run(debug=True, host="0.0.0.0")
__author__ = 'Administrator' from admin import app app.run(debug=True)
# -*- coding: utf-8 -*- """ app entry """ import os from admin import app try: import pymysql pymysql.install_as_MySQLdb() except ImportError: pass PORT = os.getenv('PORT', '4000') app.run(port=int(PORT), host='0.0.0.0', debug=False)
from admin import app as application if __name__ == "__main__": application.run()
from admin import app, db from admin.control.user_mgmt import register_admin db.create_all() register_admin() if __name__ == '__main__': app.run(host='0.0.0.0', port='8000', debug=True)
def main(): usage = "Usage: %prog [crawl|worker|fetch|update|remove|add|download|admin|shell] [options] arg" parser = OptionParser(usage) try: cmd = sys.argv[1] except IndexError: parser.error("incorrect number of arguments") parser.add_option("-l", "--loglevel", dest="loglevel", help="log level.") if cmd == "crawl": from crawler import Detailer, Downloader parser.add_option("-a", "--action", dest="action", help="detail or download?") options, args = parser.parse_args(args=sys.argv[1:]) if options.action == "detail": c = Detailer(config=settings) elif options.action == "download": c = Downloader(config=settings) c.start() elif cmd == "update": from core.base import Base parser.add_option("-t", "--ptype", dest="ptype", help="paid or free", default="free") options, args = parser.parse_args(args=sys.argv[1:]) engine = Base(settings) engine.reschedule(options.ptype) elif cmd == 'remove': from core.base import Base parser.add_option("-a", "--appids", dest="appids", help="app id string") options, args = parser.parse_args(args=sys.argv[1:]) engine = Base(settings) [_ for _ in engine.remove(*options.appids.split(','))] elif cmd == 'add': from core.base import Base parser.add_option("-a", "--appid", dest="appid", help="app id string", default="") parser.add_option("", "--force", dest="force", help="schedule appid immedite") options, args = parser.parse_args(args=sys.argv[1:]) engine = Base(settings) appids = options.appid.split(',') n = engine.add(appids, force=options.force) print "%d appids scheduled." % n elif cmd == 'shell': from core.base import Base parser.add_option("-u", "--uid", dest="uid", help="use the specifid google user to fetch.") options, args = parser.parse_args(args=sys.argv[1:]) engine = Base(settings) engine.shell(options.uid) elif cmd == 'fetch': """Sync fetch, get detail and download apk file, then save to s3 and mongodb.""" from core.base import Base parser.add_option("-a", "--appid", dest="appid", help="give the appid") parser.add_option("-u", "--uid", dest="uid", help="use the specifid google user to fetch.") options, args = parser.parse_args(args=sys.argv[1:]) engine = Base(settings) engine.fetch(options.appid, options.uid) elif cmd == 'detail': from core.base import Base parser.add_option("-a", "--appid", dest="appid", help="give the appid") options, args = parser.parse_args(args=sys.argv[1:]) engine = Base(settings) engine.detail(options.appid) elif cmd == 'download': from core.base import Base parser.add_option("-a", "--appid", dest="appid", help="give the appid") parser.add_option("-d", "--dist", dest="dist", help="relocate the file to distination.") options, args = parser.parse_args(args=sys.argv[1:]) engine = Base(settings) engine.download(options.appid, dist=options.dist) elif cmd == 'admin': from admin import app parser.add_option("-H", "--host", dest="host", help="the host for web handler", default=settings.HOST) parser.add_option("-P", "--port", dest="port", help="the port for web handler", default=settings.PORT) options, args = parser.parse_args(args=sys.argv[1:]) settings.HOST = options.host settings.PORT = options.port app.run(settings) elif cmd == 'worker': from importlib import import_module from celery.bin import worker parser.add_option("-a", "--app", dest="app", help="specify a celery app") parser.add_option("-q", "--queues", dest="queues", help="the queues whole worker handle") parser.add_option("-c", "--concurrency", dest="concurrency", help="concurrency number", type=int, default=4) options, args = parser.parse_args(args=sys.argv[1:]) app_module = import_module('.{}'.format(options.app), package='worker') if options.queues: app_module.c.select_queues(options.queues.split(',')) task = worker.worker(app=app_module.c) opt = { 'hostname': "celery@{}_{}".format(options.app, options.queues or 'all'), 'concurrency': options.concurrency, 'loglevel': 'INFO', 'traceback': True } task.run(**opt)
import os from admin import app from common import login app.register_blueprint(login.blueprint) from common import gcp app.register_blueprint(gcp.blueprint) from common import assets app.register_blueprint(assets.blueprint) if __name__ == "__main__": app.run(host="0.0.0.0", port=5002, extra_files=[ os.path.join(app.config.root_path, '../default_config.cfg'), os.path.join(app.config.root_path, '../config.cfg'), ])
__author__ = "mensur" from admin import app app.debug = True if __name__ == "__main__": app.run(host="0.0.0.0", port=8080)
__author__ = 'mensur' from admin import app app.debug = True app.secret_key = 'A0Zr98j/3yX R~XHH!jmN]LWX/,?RT' if __name__ == "__main__": app.run(host='0.0.0.0', port=8080)
import sys reload(sys) sys.setdefaultencoding('utf8') from admin import app if __name__ == '__main__': import sys reload(sys) sys.setdefaultencoding('utf8') app.run(host='0.0.0.0', port=80, debug=False)