예제 #1
0
def main():

    # initialization loop just incase this server initializes before postgres
    try:
        sql.create_all()
    except OperationalError:
        logging.error('Unable to connect to database. Trying again ...')
        time.sleep(1)
        main()
    except KeyboardInterrupt:
        exit()

    connex_app.add_api('openapi.yml')
    connex_app.run(host='0.0.0.0', port=5001, debug=True)
예제 #2
0
from flask_migrate import Migrate
from config import db, connex_app

migrate = Migrate(connex_app.app, db)
connex_app.add_api("swagger.yml")


@connex_app.route("/")
def index():
    return "<h4>Job Monitoring by Reagan Balongcas, GRID Trainee</h4>"


if __name__ == "__main__":
    connex_app.run()
예제 #3
0
#!/usr/bin/env python3
"""
Main module of the server file
"""

import connexion
from config import connex_app as app
from params import cfg

# Read the swagger.yml file to configure the endpoints
app.add_api("swagger.yml")


# create a URL route in our application for "/"
@app.route("/")
def home():
    return "Server up and running."


if __name__ == "__main__":
    app.debug = cfg['debug']
    app.run(host=cfg['host'], port=cfg['port'], ssl_context=cfg['ssl_context'])
예제 #4
0
def runserver():
    connex_app.run(debug=True)
예제 #5
0
    :return:        the rendered template 'index.html'
    """
    return render_template('index.html')


# If we're running in stand alone mode, run the application
if __name__ == '__main__':
    q = Queue()
    HLController = HomeLynkController(q)
    HLController.daemon = True
    HLController.start()
    if USE_SIMULATION:
        SIM_CONTROLLER.set_queue(q)
        if SIM_REGISTER_FROM_DATABASE:
            SIM_CONTROLLER.register_devices_from_database()
        else:
            device = Lamp("Staande Lamp 01", '0/0/1')
            SIM_CONTROLLER.register_device(device)
        SIM_CONTROLLER.daemon = True
        SIM_CONTROLLER.start()

    else:
        socketThread = TCPThread(1, "Thread-1", 1, q)
        socketThread.subscribe(HLController)

        socketThread.daemon = True

        socketThread.start()

    connex_app.run(host='0.0.0.0', port=5001, debug=False)
예제 #6
0
from flask import render_template
from config import connex_app

connex_app.add_api('swagger.yml')
@connex_app.route('/')
def home():
    return render_template('home.html')

if __name__ == '__main__':
    connex_app.run(host='0.0.0.0', port=5000, debug=True)