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)
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'))
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()
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()
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
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
from web.app import app from config import host if __name__ == "__main__": app.run(host=host, debug=True)
def run(): if __name__ == "__main__": app.run(host='0.0.0.0', port=2000) return app
from web.app import app if __name__ == '__main__': app.run(host='0.0.0.0', port=80)
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)
def run_web(): app.run(host='0.0.0.0')
#!/usr/bin/env python from web.app import app if __name__ == "__main__": app.run(debug=True, host='0.0.0.0', use_reloader=True)
def main(): app.run(debug=True, host="0.0.0.0", port=80)
from web.app import app if __name__ == '__main__': app.run(host='0.0.0.0', port=81, debug=False)
from web.app import app app.run(host="0.0.0.0", port=int("1337"), debug=True)
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()
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)
from config import web_port_number from web.app import app app.run(port=web_port_number)
def web(self): app.run(host='0.0.0.0', port=5000)
from web.app import app import web.handler options = { 'debug': True, 'host': '0.0.0.0', 'port': 8000, } if __name__ == '__main__': app.run(**options)
def main(): app.run(host='0.0.0.0', port=5000)
from web.app import app if __name__ == '__main__': app.run(host='0.0.0.0', port=5000)
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')
''' 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)
def service(): app.debug = False app.run(host='0.0.0.0', port=1081)
from web.app import app if __name__ == "__main__": app.run(debug=False)
from web.app import app if __name__ == "__main__": app.run(host='0.0.0.0')
from web.app import app app.run(debug=True)
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)
import sys sys.path.insert(0, './') from web.app import app from flask_cors import CORS CORS(app) if __name__ == '__main__': app.run()
# -*- 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')
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)
from web.app import app DEBUG = True app.run(debug=DEBUG)
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"))
from web.app import app as application if __name__ == '__main__': application.run()