Ejemplo n.º 1
0
Archivo: app.py Proyecto: xiMBest/noSQL
import logging

from controllers.EventHubController import EventHubController
from extensions import api, app

logging.basicConfig(level=logging.INFO)


@app.route('/')
def hello_world():
    return 'Lab 9'


api.add_resource(EventHubController, "/eventhub")

if __name__ == '__main__':

    app.run(debug=True)
Ejemplo n.º 2
0
from extensions import app
from extensions import jwt

# import model classes to create the tables
from models import user
from models import lastlocationpostgis
from models import userhealth
from models import token_blacklist
from models import interactedusers
from models import fcm_tokens
from models import subscribe
from models import feedback

# create dbs
db.create_all()
db.session.commit()

# create admin and other users here in database as:
'''
admin = User(username='******', email='*****@*****.**')
>>> guest = User(username='******', email='*****@*****.**')
'''

# import view apis
import views   # noqa: E402
import myadmin

if __name__ == '__main__':
    app.run(host='0.0.0.0', port=8000, debug=True)
    # app.run(host='127.0.0.1', port=8000, debug=True)
Ejemplo n.º 3
0
Archivo: main.py Proyecto: jsphyin/idb
    )) \
        .filter(models.SearchResult.score > 0) \
        .order_by(models.SearchResult.score.desc(), models.SearchResult.type, models.SearchResult.id)

    return paginated(q)


@app.route('/')
@app.route('/about')
@app.route('/search')
@app.route('/boardgame/<id>/<model>')
@app.route('/boardgamedesigner/<id>/<model>')
@app.route('/<any("game", "genre", "developer", "event"):model>/<id>')
@app.route('/<any("games", "genres", "developers", "events"):model>')
@app.route('/<any("games", "genres", "developers", "events"):model>/')
def grid(model=None, id=None):
    return render_template('index.html')


@app.route('/wiki')
def wiki():
    abort(404)


if __name__ == '__main__':
    from os import sys, path
    sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))

    # Run locally in debug mode (gunicorn runs the app in production)
    app.run(host='127.0.0.1', port=8080, debug=True, threaded=True)
Ejemplo n.º 4
0
from extensions import app, db, ma, ENV
import os
from routes.main import main
# import flask_monitoringdashboard as dashboard

if ENV == 'dev':
    app.debug = True
    app.config['SQLALCHEMY_DATABASE_URI'] = "sqlite:///./sql_app.db"
else:
    app.debug = False
    app.config['SQLALCHEMY_DATABASE_URI'] = os.environ.get('DATABASE_URL')

app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False

app.register_blueprint(main)

db.init_app(app)
with app.app_context():
    db.create_all()
    # dashboard.bind(app)  # add analytics to "/dashboard"

if __name__ == '__main__':
    app.run()
Ejemplo n.º 5
0
        elif args['module_id'] == None:
            all = RiskOccurDb.query.filter_by(type_id=args['type_id'],
                                              r_id=args['r_id']).all()
        elif args['r_id'] == None:
            all = RiskOccurDb.query.filter_by(
                type_id=args['type_id'], module_id=args['module_id']).all()
        else:
            all = RiskOccurDb.query.all()

        for item in all:
            res.append({
                'id': item.id,
                'type_id': item.type_id,
                'module_id': item.module_id,
                'r_id': item.r_id,
                'result': item.result
            })

        return jsonify(res)


api.add_resource(RiskOccurApi,
                 '/riskOccurDb/<int:type_id>/<int:module_id>/<int:r_id>')
api.add_resource(RiskOccurDbListApi, '/riskOccurDbs')

if __name__ == "__main__":
    with app.app_context():
        db.create_all()
    app.debug = True
    app.run(host="0.0.0.0", port="8000")
Ejemplo n.º 6
0
from searchModule.routes import *
from extensions import Base, engine, app
from config.base import port, hostname
from Amfi_list import *
from searchModule.routes import auto_complete
app.register_blueprint(auto_complete)

if __name__ == '__main__':
    app.run(debug=True, port=port if port else 5001, host=hostname)