def initialization(host, port):

    try:
        port = int(os.environ.get("PORT", port))
        app.run(host, port)
    except BaseException, error:
        log.error(error.message)
示例#2
0
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)
示例#3
0
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)
示例#5
0
#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)
示例#6
0
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')
示例#7
0
文件: test.py 项目: nickwangog/Makiti
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)
示例#9
0
from api.app import app

app.run(host="localhost", port=5000, debug=True, processes=1)
示例#10
0
from api.app import app as app

if __name__ == "__main__":
    app.run(use_reloader=True, debug=True)
示例#11
0
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()
示例#12
0
###################
#
#  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
示例#13
0
from api.app import app
from api.views import *

if __name__ == "__main__":
    app.run(debug=app.config['DEBUG'])
示例#14
0
#!/usr/bin/env python
from api.app import app

app.run(host='127.0.0.1', port=8083, debug=True, use_reloader=False)
示例#15
0
from api.app import app


if __name__ == '__main__':
    app.run(host='0.0.0.0')
示例#16
0
文件: run.py 项目: aqualove/api
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)
示例#17
0
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)
示例#18
0
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)
示例#19
0
from api.app import app

if __name__ == '__main__':
    app.run(host='localhost', port=8080, debug=True)
示例#20
0
from api.app import app

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

示例#21
0
from api.app import app

if __name__ == "__main__":
    app.run(debug=True, host="0.0.0.0")
示例#22
0
from api.app import app

if __name__ == "__main__":
    app.run()
示例#23
0

@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)
示例#24
0
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)
示例#25
0
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')
示例#26
0
from api.app import app


if __name__ == "__main__":
    app.run(debug=True)
示例#27
0
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)
示例#28
0
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")
示例#29
0
#!/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"])
示例#30
0
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()
示例#31
0
from api.app import app

if __name__ == '__main__':
    app.run(host='0.0.0.0', port=8080, debug=True)
示例#32
0
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)
示例#33
0
 def start(self):
     app.run(host=self.host, port=self.port, debug=self.debug)
示例#34
0
def run():
    app.run(debug=DEBUG)
示例#35
0
文件: run.py 项目: aqualove/api
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)