Example #1
0
from service import app
if __name__ == '__main__':
    app.run(threaded=True, host='0.0.0.0', port=5000)
Example #2
0
from service import app

# For local development only
if __name__ == '__main__':
    app.run(debug=True, host='0.0.0.0', port=8000)
Example #3
0
from service import app

app.run(host="0.0.0.0", port=1169)
Example #4
0
from service import app

app.run(debug=True, host="0.0.0.0", port=8080)
#!/usr/bin/env python

from service import app

if __name__ == '__main__':
    app.run(host='localhost',
            ssl_context=('./ssl/server.crt', './ssl/server.key'))
Example #6
0
                   'updatetime', 'size', 'name', 'encryption', 'public',
                   'hashcode', 'is_delete')


class MyAdminIndexView(AdminIndexView):
    @expose('/')
    @login_required
    def index(self):
        if not hasattr(current_user, 'is_admin') or current_user.is_admin != 1:
            return redirect(url_for('login', next=request.url, type='manager'))
        return super(MyAdminIndexView, self).index()


admin = Admin(
    app,
    name='Cowry Admin Console',
    index_view=MyAdminIndexView(),
    template_mode='bootstrap3',
)
admin.add_view(DbView(schema.manager.Manager, d.session))
admin.add_view(DbView(schema.user.User, d.session))
admin.add_view(FilesModelView(schema.file.File, d.session))
admin.add_view(DbView(schema.syslog.Syslog, d.session))
admin.add_view(rediscli.RedisCli(Redis()))

# path = op.join(op.dirname(__file__), 'static')
# admin.add_view(FileAdmin(path, '/static/', name='Static Files'))

if __name__ == '__main__':
    app.run(port=8000)
    if not app.products_dao:
        app.products_dao = ProductsDAO(ingest_defaults())
    return app.products_dao


@app.route("/")
def home():
    return jsonify("try GET /data/dgd or GET /data/cheapest/10")


@app.route("/data/<id>", methods=["GET"])
def get_by_id(id: str):
    response = get_dao().get_product_by_id(id)
    if response is None:
        return jsonify(result="nothing!"), 200
    return response, 200


@app.route("/data/cheapest/<number>", methods=["GET"])
def get_n_cheapest(number: int):
    try:
        n = int(number)
    except ValueError:
        return jsonify(error=f"This ({number}) is not an int"), 400
    response = get_dao().get_n_cheapest_products(n)
    return jsonify(response), 200


if __name__ == "__main__":
    app.run(host="0.0.0.0", port=8080)
Example #8
0
#!/usr/bin/env python

# Copyright 2017 Kubos Corporation
# Licensed under the Apache License, Version 2.0
# See LICENSE file for details.
"""
Boilerplate main for service application.
"""

import argparse
from service import app
import yaml

parser = argparse.ArgumentParser(description='Example Service')
parser.add_argument('config', type=str, help='path to config file')
args = parser.parse_args()

with open(args.config) as ymlfile:
    cfg = yaml.load(ymlfile)

app = app.create_app()
app.run(host=cfg['APP_IP'], port=cfg['APP_PORT'])
Example #9
0
from service import app

app.run(host="0.0.0.0", port=11100)

Example #10
0
from service import app, get_blueprint

app.register_blueprint(get_blueprint('monitor'), url_prefix='/monitor')
if __name__ == '__main__':
    app.run(host='0.0.0.0', debug=True, threaded=True)
Example #11
0
import argparse

from service import app
from service.routes import api_blueprint

parser = argparse.ArgumentParser(description='Run Git Profile API Server.')
parser.add_argument('-H',
                    '--hostname',
                    type=str,
                    default='127.0.0.1',
                    help='the hostname for the api server')
parser.add_argument('-P',
                    '--port',
                    type=int,
                    default='5000',
                    help='the port for the api server')

args = parser.parse_args()

app.register_blueprint(api_blueprint)

if __name__ == '__main__':
    app.run(args.hostname, port=args.port)
Example #12
0
from service import app

app.run(host='192.168.1.77')
Example #13
0
# -*- encoding:utf-8 -*-
from service import app
from utils.logger_conf import configure_logger
logger = configure_logger('root')

__author__ = 'jingyu.he'

if __name__ == '__main__':
    app.run(host='0.0.0.0', port=8884)
Example #14
0
from service import app

if "__main__" == __name__:
    app.run()
Example #15
0
from service import app

if __name__ == "__main__":
    app.run()
Example #16
0
from service import app

app.run(host='192.168.137.134')
def run_app():
    CsrfProtect(app)
    port = int(os.environ.get('PORT', 8003))
    app.run(host='0.0.0.0', port=port)
Example #18
0
def run_devel_server(app):
    app.run(host=FLASK_HOST, port=FLASK_PORT, debug=DEBUG)
Example #19
0
from service import app
import sys


if __name__ == '__main__':
    port = 5005
    if len(sys.argv) > 1:
        port = int(sys.argv[1])
    app.run(host='0.0.0.0',port = port, debug=False)
Example #20
0
def http_server_thread():
    app.run(debug=False, port=config.dev_listen_port)
Example #21
0
"""
This script runs the service application using a development server.
"""

from os import environ
from service import app

if __name__ == '__main__':
    HOST = environ.get('SERVER_HOST', 'localhost')
    try:
        PORT = int(environ.get('SERVER_PORT', '5555'))
    except ValueError:
        PORT = 5555
    app.run(HOST, PORT)
Example #22
0
# -*- coding:utf-8 -*-

from service import app

if __name__ == "__main__":
    # app.run('0.0.0.0', port=10001, debug=True)
    app.run('0.0.0.0', port=9800, debug=True)
from service import app
import sys

if len(sys.argv) != 2:
	print "usage: python start_service.py <option:prod or dev>"
else:
	if sys.argv[1] == "dev":
		app.run(debug=True)
	elif sys.argv[1] == "prod":
		app.run(debug=False)
	else:
		print "wrong option: " + sys.argv[1] 
Example #24
0
from service import app, resources
app.run(debug=True)
Example #25
0
#!/usr/bin/env python

import os
import service
import mapper
# from service import application
from service import app as application

# todo?
mapper.init()

# def run():
#     service.app.run(debug=False, host='0.0.0.0')

if __name__ == '__main__':
    # mapper.init()
    application.run(debug=False, host='0.0.0.0')
Example #26
0
#!/usr/bin/env python

from service import app

import argparse
import sys

if __name__ == '__main__':
    parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter, add_help=False)
    parser.add_argument('-a', dest='address', default='127.0.0.1:5432')
    parser.add_argument('-b', dest='bind_to', default='127.0.0.1:5000')
    parser.add_argument('-d', dest='database', default='db')
    parser.add_argument('-u', dest='username', default='user')
    parser.add_argument('-p', dest='password', default='pass')
    opts = parser.parse_args()
    app.config['host'] = opts.address.split(':')[0]
    app.config['port'] = opts.address.split(':')[1]
    app.config['database'] = opts.database
    app.config['username'] = opts.username
    app.config['password'] = opts.password
    app.run(host=opts.bind_to.split(':')[0], port=int(opts.bind_to.split(':')[1]), debug=False)
Example #27
0
from service import app

if __name__ == '__main__':
    app.run(host='0.0.0.0')
Example #28
0
"""
Recommendation Service Runner
Start the Recommendation Service and initializes logging
"""

import os
from service import app

# Pull options from environment
DEBUG = (os.getenv('DEBUG', 'False') == 'True')
PORT = os.getenv('PORT', '5000')

######################################################################
#   M A I N
######################################################################
if __name__ == "__main__":

    print "*************************************************************"
    print " R E C O M M E N D A T I O N   S E R V I C E   R U N N I N G"
    print "*************************************************************"

    #server.initialize_logging()
    app.run(host='0.0.0.0', port=int(PORT), debug=DEBUG)
Example #29
0
from service import app

if __name__ == "__main__":
    app.run(host="10.2.2.50", port="8000")
Example #30
0
import subprocess
import time
from service import app
from service import config

ngrok = config.get_param('exe', 'NGROK')
token = config.get_param('authtoken', 'NGROK')

if __name__ == '__main__':
    with subprocess.Popen([ngrok, 'authtoken', token]) as ngrok_auth:
        with subprocess.Popen(
            [ngrok, 'http', config.port],
                creationflags=subprocess.CREATE_NEW_CONSOLE) as ngrok_process:
            time.sleep(5)
            app.run(port=config.port)
Example #31
0
# encoding: utf-8

from service import app, PORT

if __name__ == '__main__':
    app.run(port=PORT, host='0.0.0.0')
Example #32
0
from service import app

if __name__ == '__main__':
    app.run(port=4999, debug=True)
Example #33
0
#=================================================================
# Copyright(c) Institute of Software, Chinese Academy of Sciences
#=================================================================
# Author : [email protected]
# Date   : 2016/05/25

from service import app

if __name__ == '__main__':
    app.run(host='0.0.0.0', debug=True)
Example #34
0
 # -*- coding:utf-8 -*-

from service import app

if __name__ == "__main__":
    app.run('0.0.0.0', port=10003, debug=True)



Example #35
0
from service import app

app.run(host='192.168.43.14') #your ip
Example #36
0
from service import app, sched

if __name__ == '__main__':
	print 'Starting simple-scheduler service...'	
	#sched.start()	
	app.run(debug = False, host='0.0.0.0', port = 5003)	
	sched.shutdown()
	
Example #37
0
from service import app
from model import form


# Endpoints:
@app.route("/", methods=['POST'])
def formController():
    return form()


if __name__ == "__main__":
    app.run(debug=True)
Example #38
0
File: srv.py Project: rch/flask-f2
#!/usr/bin/env python

from service import app

if __name__ == '__main__':
    app.run(host='0.0.0.0', port=5000, debug=True)
Example #39
0
from service import app
app.run(debug=True, host='0.0.0.0', port=8181)
from service import app
if __name__ == '__main__':
    app.debug = True
    app.run('0.0.0.0', 8888)
def run_app():
    port = int(app.config.get('PORT', 8005))
    app.run(host='0.0.0.0', port=port)