コード例 #1
0
 def final(self):
     global _port_F
     #import ctypes
     #cytypes.windll.user32.ShowWindow(ctypes.windll.kernel32.GetConsoleWindow(), 0)
     import sys
     sys.stdout = sys.stderr = open(os.devnull, 'w')
     app.run(host='0.0.0.0', port=_port_F, debug=False)
コード例 #2
0
def main():
    util = Util()
    elastic = Elastic()

    # get config and set logger
    config = util.get_params()
    logger = util.set_logger('main')

    # create index in elastic search
    msg = elastic.create_index()

    # check that it was created
    if msg is None:
        logger.info('Index created successfully!')
    else:
        logger.error(f'Error occurred in creating index:\n {msg}')

    # insert records to elasticsearch
    diff = elastic.insert_elastic()

    # check that it was inserted
    if diff == 0:
        logger.info('Movies inserted successfully to elasticsearch!')
    else:
        logger.error(f'Elasticsearch: Error occurred in {diff} movies!')

    # run web app
    app.run(host='0.0.0.0', port=5002, debug=config['app'].getboolean('debug'))
コード例 #3
0
def main():
    try:
        cmd = sys.argv[1]
        assert (cmd in cmds)
    except:
        invocations = ["python pypitches.py {0}".format(cmd) for cmd in cmds]
        print "usage:  " + "\n        ".join(invocations)
        sys.exit()
    if cmd == 'initdb':
        setup_postgres.initdb(postgres_db, postgres_user, postgres_password)
        sys.exit()
    else:
        import model
        model.SessionManager.create(postgres_db, postgres_user,
                                    postgres_password)
        import load
        from web.app import app
        import select_gamedirs
        from plot_pitch_locations import do_plots

    if cmd == 'web':
        app.run()
    elif cmd == 'webtest':
        app.run('pypitchestest', 'pypitches', 'slider')
    elif cmd == 'ipython':
        embed()
    elif cmd == 'file':
        # will generate output by a config file
        # a la plot_pitch_locations.py
        assert len(sys.argv) > 2, "usage: python pypitches.py file file.yaml"
        do_plots(sys.argv[2])

    elif cmd == 'download':
        # hit the MLBAM server and get it all
        pass
    elif cmd == 'classify':
        with model.SessionManager.get().begin_nested():
            static_dir = sys.argv[2]
            select_gamedirs.classify_local_dirs_by_filesystem(static_dir)
        model.SessionManager.commit()
    elif cmd == 'load':
        statuses = set(sys.argv[2:]) or set(['final'])
        with model.SessionManager.get().begin_nested():
            load.load(statuses)
        model.SessionManager.commit()
コード例 #4
0
ファイル: pypitches.py プロジェクト: gregoryck/pypitches
def main():
    try:
        cmd = sys.argv[1]
        assert(cmd in cmds)
    except:
        invocations = ["python pypitches.py {0}".format(cmd) for cmd in cmds]
        print "usage:  " + "\n        ".join(invocations)
        sys.exit()
    if cmd == 'initdb':
        setup_postgres.initdb(postgres_db, postgres_user, postgres_password)
        sys.exit()
    else:
        import model
        model.SessionManager.create(postgres_db, postgres_user, postgres_password)
        import load
        from web.app import app
        import select_gamedirs
        from plot_pitch_locations import do_plots

    if cmd == 'web':
        app.run()
    elif cmd == 'webtest':
        app.run('pypitchestest', 'pypitches', 'slider')
    elif cmd == 'ipython':
        embed()
    elif cmd == 'file':
        # will generate output by a config file
        # a la plot_pitch_locations.py
        assert len(sys.argv) > 2, "usage: python pypitches.py file file.yaml"
        do_plots(sys.argv[2])

    elif cmd == 'download':
        # hit the MLBAM server and get it all
        pass
    elif cmd == 'classify':
        with model.SessionManager.get().begin_nested():
            static_dir = sys.argv[2]
            select_gamedirs.classify_local_dirs_by_filesystem(static_dir)
        model.SessionManager.commit()
    elif cmd == 'load':
        statuses=set(sys.argv[2:]) or set(['final'])
        with model.SessionManager.get().begin_nested():
            load.load(statuses)
        model.SessionManager.commit()
コード例 #5
0
ファイル: main.py プロジェクト: tambetm/spearmint
def start_web_view(options, experiment_config, chooser):
    '''Start the web view in a separate process.'''

    from web.app import app    
    port = get_available_port(options.web_status_port)
    print "Using port: " + str(port)
    if options.web_status_host:
        print "Listening at: " + str(options.web_status_host)
    app.set_experiment_config(experiment_config)
    app.set_chooser(options.chooser_module,chooser)
    debug = (options.verbose == True)
    start_web_app = lambda: app.run(debug=debug, port=port, host=options.web_status_host)
    proc = multiprocessing.Process(target=start_web_app)
    proc.start()

    return proc
コード例 #6
0
ファイル: main.py プロジェクト: tambetm/spearmint
def start_web_view(options, experiment_config, chooser):
    '''Start the web view in a separate process.'''

    from web.app import app
    port = get_available_port(options.web_status_port)
    print "Using port: " + str(port)
    if options.web_status_host:
        print "Listening at: " + str(options.web_status_host)
    app.set_experiment_config(experiment_config)
    app.set_chooser(options.chooser_module, chooser)
    debug = (options.verbose == True)
    start_web_app = lambda: app.run(
        debug=debug, port=port, host=options.web_status_host)
    proc = multiprocessing.Process(target=start_web_app)
    proc.start()

    return proc
コード例 #7
0
ファイル: web_server.py プロジェクト: stnoah1/mcb
from web.app import app
from config import host

if __name__ == "__main__":
    app.run(host=host, debug=True)
コード例 #8
0
def run():
    if __name__ == "__main__":
        app.run(host='0.0.0.0', port=2000)
    return app
コード例 #9
0
from web.app import app

if __name__ == '__main__':
	app.run(host='0.0.0.0', port=80)
コード例 #10
0
ファイル: web.py プロジェクト: lichanping/photodup
from config import port
from web.app import app

app.run(port=port)
    

    img_dir = config['DEFAULT']['images_directory']
    results_dict = {}
    images = list(get_image_files(img_dir))
    for image in tqdm.tqdm(images):
        info = hash_file(image)
        if info == 0:
            continue

        hash_value = info['hash']

        if hash_value not in results_dict:
            file_name = os.path.basename(info['_id'])
            results_dict[hash_value] = [file_name, 1]
        else:
            results_dict[hash_value][1] += 1

    count = list(results_dict.values())
    sorted_count = sorted(count, key=lambda x: x[1], reverse=True)
    
    with ImagesDB(IMG_INFO_DB_FILENAME) as imgDb:        
        imgDb.insert_batch(sorted_count)

if __name__ == "__main__":
    process()
    if len(sys.argv) > 1:
        if sys.argv[1] == "web":
            from web.app import app
            app.run(1111)
    
コード例 #12
0
def run_web():
    app.run(host='0.0.0.0')
コード例 #13
0
ファイル: app.py プロジェクト: hughes/SkymorphTO
#!/usr/bin/env python
from web.app import app

if __name__ == "__main__":
    app.run(debug=True, host='0.0.0.0', use_reloader=True)
コード例 #14
0
ファイル: main.py プロジェクト: RyanJMah/spotify_queue_app
def main():
    app.run(debug=True, host="0.0.0.0", port=80)
コード例 #15
0
from web.app import app


if __name__ == '__main__':
    app.run(host='0.0.0.0', port=81, debug=False)
コード例 #16
0
ファイル: run.py プロジェクト: B-Rich/Flask-Materia
from web.app import app

app.run(host="0.0.0.0", port=int("1337"), debug=True)
コード例 #17
0
ファイル: run.py プロジェクト: Major-w/Graduation_design
def profile(length=25, profile_dir=None):
    """Start the application under the code profiler."""
    from werkzeug.contrib.profiler import ProfilerMiddleware
    app.wsgi_app = ProfilerMiddleware(app.wsgi_app, restrictions=[length],
                                      profile_dir=profile_dir)
    app.run()
コード例 #18
0
import logic.browser
from web.app import app

if __name__ == '__main__':
    HOST = app.config['HOST']
    PORT = app.config['PORT']
    app.run(HOST, PORT, debug=True)
コード例 #19
0
ファイル: web.py プロジェクト: zhukui/photodup
from config import web_port_number
from web.app import app

app.run(port=web_port_number)
コード例 #20
0
ファイル: main.py プロジェクト: mina998/amz_data_transfer
 def web(self):
     app.run(host='0.0.0.0', port=5000)
コード例 #21
0
ファイル: app.py プロジェクト: nepteam/eryri-web
from web.app import app
import web.handler

options = {
    'debug': True,
    'host': '0.0.0.0',
    'port': 8000,
}

if __name__ == '__main__':
    app.run(**options)
コード例 #22
0
ファイル: main.py プロジェクト: ashibaev/tickers
def main():
    app.run(host='0.0.0.0', port=5000)
コード例 #23
0
from web.app import app

if __name__ == '__main__':
    app.run(host='0.0.0.0', port=5000)
コード例 #24
0
import sys
from web.app import app

if len(sys.argv) < 2:
    raise Exception('require more than 2 args')

if sys.argv[1] == 'runserver':
    port = 10203
    if len(sys.argv) > 2:
        port = int(sys.argv[2])
    app.run(host='0.0.0.0', port=port)
else:
    raise Exception('not exists command')
コード例 #25
0
'''
This python file is the main control
component for all web requests from
the client to the server.
This file shall import from
the "app" module and run it.
The "host" and "port" values are
needed to allow remote access
(non-localhost) and reachable from
localhost/IP address of the machine
running this file.
'''
if __name__ == '__main__':
    from sequence.sequence import Sequence
    from web.app import app
    app.run(host='0.0.0.0', debug=True, port=80)
コード例 #26
0
ファイル: app.py プロジェクト: edwardball/asterank
#!/usr/bin/env python
from web.app import app

if __name__ == "__main__":
  app.run(debug=True, host='0.0.0.0', use_reloader=True)
コード例 #27
0
ファイル: manage.py プロジェクト: mina998/amzAnalysis
def service():

    app.debug = False
    app.run(host='0.0.0.0', port=1081)
コード例 #28
0
from web.app import app

if __name__ == "__main__":
    app.run(debug=False)
コード例 #29
0
from web.app import app

if __name__ == "__main__":
    app.run(host='0.0.0.0')
コード例 #30
0
ファイル: run_app.py プロジェクト: anubh-v/RedditSpeaks
from web.app import app

app.run(debug=True)
コード例 #31
0
ファイル: run.py プロジェクト: skycucumber/xuemc
        pass
        print "POST a Message:", request.data,"--"
        body = json.loads(request.data)
        if body[ProtocolItem.MESSAGES][ProtocolItem.DEST_TYPE] == ProtocolItem.VALUE_IOS:
            threading.Thread(target=Util.push_ios,args=([body[ProtocolItem.MESSAGES][ProtocolItem.DEST_ID]], "alarm", body[ProtocolItem.MESSAGES][ProtocolItem.CONTENT])).start()
#            Util.push_ios([body[ProtocolItem.MESSAGES][ProtocolItem.DEST_ID]], 'alarm', body[ProtocolItem.MESSAGES][ProtocolItem.CONTENT])
        return {'_id':'0'}

    def get(self):
        return {'get':'None'}


api.add_resource(Messages, '/bd/api/messages')



if __name__ == '__main__':
    app.run(debug=True,port= 5001)












コード例 #32
0
import sys
sys.path.insert(0, './')
from web.app import app
from flask_cors import CORS
CORS(app)

if __name__ == '__main__':
    app.run()
コード例 #33
0
# -*- coding: utf-8 -*-

from flask_failsafe import failsafe

# for flask failsafe
@failsafe
def create_app():
    from web.app import app
    return app

if(__name__ == "__main__"):
    app = create_app()
    from web.app import auth
    app.debug = app.config["DEBUG_MODE"]
    # move this to script 
    from web.model import Label, Inspiration, LabelInspirationRelationShip
    init_class = [auth.User, Label, Inspiration, LabelInspirationRelationShip]

    for kls in init_class:
        kls.create_table(fail_silently=True)

    app.run(host='0.0.0.0')
コード例 #34
0
ファイル: run.py プロジェクト: mali86007/xuemc
                   methods=['POST', 'PATCH'],
                   preprocessors={'POST': [pre_post_test]},
                   url_prefix='/bd/api/v1.0')


class Messages(Resource):
    def post(self):
        pass
        print("POST a Message:", request.data, "--")
        body = json.loads(request.data)
        if body[ProtocolItem.MESSAGES][
                ProtocolItem.DEST_TYPE] == ProtocolItem.VALUE_IOS:
            threading.Thread(
                target=Util.push_ios,
                args=([body[ProtocolItem.MESSAGES][ProtocolItem.DEST_ID]
                       ], "alarm",
                      body[ProtocolItem.MESSAGES][ProtocolItem.CONTENT]
                      )).start()


#            Util.push_ios([body[ProtocolItem.MESSAGES][ProtocolItem.DEST_ID]], 'alarm', body[ProtocolItem.MESSAGES][ProtocolItem.CONTENT])
        return {'_id': '0'}

    def get(self):
        return {'get': 'None'}

api.add_resource(Messages, '/bd/api/messages')

if __name__ == '__main__':
    app.run(debug=True, port=5001)
コード例 #35
0
from web.app import app

DEBUG = True

app.run(debug=DEBUG)
コード例 #36
0
from web.app import app


if __name__ == "__main__":
    app.run(host="0.0.0.0", port=8080, debug=True, ssl_context=("config/ssl.crt", "config/ssl.key"))
コード例 #37
0
ファイル: wsgi.py プロジェクト: kolabszar/ScoringEngine-1
from web.app import app as application

if __name__ == '__main__':
    application.run()