Last active
June 27, 2017 09:17
-
-
Save BolajiOlajide/d5c7accf83bd61447a5eb03b7a5c29fc to your computer and use it in GitHub Desktop.
The app initialization for the ToDoList API is defined here.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Setup an initialization to delay the creation of the application after runtime. | |
This helps to enable the use of blueprint if we ever want to use it in the future. | |
""" | |
from flask import Flask | |
from flask_sqlalchemy import SQLAlchemy | |
from config import config | |
db = SQLAlchemy() | |
def create_app(config_name): | |
"""Initialize the application after runtime.""" | |
app = Flask(__name__) | |
app.config.from_object(config[config_name]) | |
db.init_app(app) | |
return app |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment