26 lines
583 B
Python
26 lines
583 B
Python
from flask import Flask
|
|
from flask_sqlalchemy import SQLAlchemy
|
|
from flask_migrate import Migrate
|
|
from config import app_config
|
|
|
|
|
|
db = SQLAlchemy()
|
|
def create_app(config_name):
|
|
app = Flask(__name__, instance_relative_config=True)
|
|
app.config.from_object(app_config[config_name])
|
|
app.config.from_pyfile('config.py')
|
|
db.init_app(app)
|
|
migrate = Migrate(app, db)
|
|
|
|
from app import models
|
|
|
|
from .api import api as api_blueprint
|
|
app.register_blueprint(api_blueprint)
|
|
|
|
|
|
@app.route('/')
|
|
def hello_world():
|
|
return 'Hello, World!'
|
|
|
|
return app
|