university-final-iot-backend/app/__init__.py

25 lines
546 B
Python
Raw Normal View History

2018-04-27 08:47:24 +00:00
# App initialization
2018-05-03 14:40:30 +00:00
from flask_api import FlaskAPI
2018-04-26 12:51:37 +00:00
from flask_sqlalchemy import SQLAlchemy
2018-05-03 14:40:30 +00:00
app = FlaskAPI(__name__, instance_relative_config=True)
app.config.from_object('config')
app.config.from_pyfile('config.py')
2018-04-26 12:51:37 +00:00
db = SQLAlchemy(app)
2018-04-27 08:47:24 +00:00
2018-05-03 12:23:24 +00:00
def setup_blueprints(app):
from .mod_devices import devices
from .mod_accounts import accounts
2018-04-27 08:47:24 +00:00
2018-05-03 12:23:24 +00:00
app.register_blueprint(devices, url_prefix='/devices')
app.register_blueprint(accounts, url_prefix='/accounts')
setup_blueprints(app)
2018-04-14 11:44:47 +00:00
2018-04-26 13:03:38 +00:00
2018-04-14 11:44:47 +00:00
@app.route("/")
def hello():
return "Hello World!"