def initialization(host, port): try: port = int(os.environ.get("PORT", port)) app.run(host, port) except BaseException, error: log.error(error.message)
def run_api(): """ Function to be called by gunicorn """ if PROD: app.run(host='0.0.0.0', port=API_PORT, debug=False) else: app.run(host='0.0.0.0', port=API_PORT, debug=True)
def main(): manager = Manager() # Init truck general data truck_data = manager.dict() init_truck_data(truck_data) # Obtain session id from router session_id = router_login() # Setup concurrent execution of web api and message polling p = Process(target=subscribe, args=(session_id, truck_data)) p.daemon = True p.start() app.config['session_id'] = session_id app.config['truck_data'] = truck_data app.run(host='0.0.0.0', port=cfg['api']['port']) p.join()
from api.app import app from api import settings if __name__ == "__main__": app.run(host="0.0.0.0", port=5000, debug=settings.DEBUG)
#YAY if __name__ == '__main__': from rq42.api42 import Api42 from api.app import app Api42.runActiveUserUpdater(300) app.run(host="0.0.0.0", port=1025)
from flask import Flask from nose.tools import set_trace from api.app import app if __name__ == "__main__": app.run(debug=True, host='0.0.0.0')
if __name__ == '__main__': from api.app import app app.run(host='0.0.0.0', port=9923)
from api.app import app import os port = int(os.environ.get('PORT', 5000)) debug = os.environ.get('DEBUG', False) app.run(host='0.0.0.0', debug = debug, port=port)
from api.app import app app.run(host="localhost", port=5000, debug=True, processes=1)
from api.app import app as app if __name__ == "__main__": app.run(use_reloader=True, debug=True)
from api.app import app as application if __name__ == '__main__': import argparse parser = argparse.ArgumentParser(description = 'API Spazi Unimi') parser.add_argument('--debug',help='Run server in debug mode',action='store_true',default=False) args = parser.parse_args() if args.debug: application.debug = True application.run()
################### # # Run Flask app for debug purposes only # ################## import api import sys import os from api.config import cfg from api.app import app #, handlers # print("FROM FLASK: DIR",dir(api)) # print("FROM FLASK: path", sys.path) print("FROM FLASK cwd:", os.getcwd()) script_path = os.path.dirname(os.path.abspath(__file__)) print("FROM FLASK: script_path", script_path) print("FROM FLASK: root_path", app.root_path) # print("FROM FLASK: instance_path", app.instance_path ) if __name__ == "__main__": app.run(host=cfg.CFG_LOCALHOST, port=cfg.CFG_PORT, debug=cfg.CFG_DEBUG) # , ssl_context=cfg.CFG_SSL_CONTEXT
from api.app import app from api.views import * if __name__ == "__main__": app.run(debug=app.config['DEBUG'])
#!/usr/bin/env python from api.app import app app.run(host='127.0.0.1', port=8083, debug=True, use_reloader=False)
from api.app import app if __name__ == '__main__': app.run(host='0.0.0.0')
import os from api.app import app if __name__ == '__main__': # On Bluemix, get the port number from the environment variable VCAP_APP_PORT # When running this app on the local machine, default the port to 8080 port = int(os.getenv('PORT', 8080)) app.run(host='0.0.0.0', port=port)
import os from api.app import app host = os.environ.get('HOST', '0.0.0.0') debug = True if os.environ.get('DEBUG', False) == 'True' else False port = int(os.environ.get('PORT', 5000)) app.run(host=host, debug=debug, port=port)
def run(): port = int(os.environ.get('PORT', 5000)) app.debug = True app.root_path = os.path.abspath(os.path.dirname(__file__)) app.run(host='0.0.0.0', port=port)
from api.app import app if __name__ == '__main__': app.run(host='localhost', port=8080, debug=True)
from api.app import app if __name__ == '__main__': app.run(debug=True)
from api.app import app if __name__ == "__main__": app.run(debug=True, host="0.0.0.0")
from api.app import app if __name__ == "__main__": app.run()
@data_blueprint.route("/transform/<string:topic>/filter", methods=["POST"]) def transform_and_spit(topic): print(request.json) output_topic = request.json.get("output_topic") filter_column = request.json.get("column") columns = request.json.get("headers") value = request.json.get("value") kwargs = { "output_topic": output_topic, "input_topic": topic, "index": columns.index(filter_column), "value": value, } info["topics"].append(kwargs) pull_transform_push.delay(**kwargs) print(kwargs) return {"ok": 1} @data_blueprint.route("/visualize") def view_data(): return render_template("index.html") api.register_blueprint(data_blueprint) if __name__ == "__main__": app.run(host="0.0.0.0", port=2233, debug=True)
from api.app import app as api_app from admin.app import app as admin_app if __name__ == '__main__': api_app.run(host='0.0.0.0', port=8000)
from api.app import app import json from datetime import datetime from src.job import job @app.route('/') def home(): return json.dumps({"Message": "Tudo certo por aqui ;)"}) @app.route('/run') def run_now(): try: job() return json.dumps( {"Job finished at": f"{datetime.now().strftime('%F %T')}"}) except Exception as error: return json.dumps({"ERROR": f'{error}'}) if __name__ == '__main__': app.run(host='0.0.0.0', port='5000')
from api.app import app if __name__ == "__main__": app.run(debug=True)
import os from api.app import app if __name__ == '__main__': app.run(host='0.0.0.0', debug=os.environ.get('DEBUG', True), port=5000)
def main(): arch = path.join(DIR_GEN, 'message.log') logging.basicConfig(filename=arch, level=logging.INFO) logging.info("Started") app.run(debug=True, port=8000) logging.info("Finished")
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Imports from api.app import app # Methods imports from api.methods.files_methods import read_settings # Run the app if __name__ == "__main__": network_settings = read_settings("network") app.run(debug=True, host=network_settings["host_ip"], port=network_settings["api_port"])
from api.app import app as application from raven import Client import logging # from raven.middleware import Sentry from os import getenv # application = Sentry( # app, # Client(getenv('SENTRY_DSN')) # ) if __name__ == "__main__": gunicorn_logger = logging.getLogger('gunicorn.error') application.logger.handlers = gunicorn_logger.handlers application.logger.setLevel(gunicorn_logger.level) application.run()
from api.app import app if __name__ == '__main__': app.run(host='0.0.0.0', port=8080, debug=True)
def run(): port = int(os.environ.get('PORT', 5000)) api.app.prepare_data() app.root_path = os.path.abspath(os.path.dirname(__file__)) app.run(host='0.0.0.0', port=port, debug=True, use_reloader=False)
def start(self): app.run(host=self.host, port=self.port, debug=self.debug)
def run(): app.run(debug=DEBUG)