Skip to content

Instantly share code, notes, and snippets.

@BolajiOlajide
Last active June 27, 2017 09:17
Show Gist options
  • Save BolajiOlajide/d5c7accf83bd61447a5eb03b7a5c29fc to your computer and use it in GitHub Desktop.
Save BolajiOlajide/d5c7accf83bd61447a5eb03b7a5c29fc to your computer and use it in GitHub Desktop.
The app initialization for the ToDoList API is defined here.
"""
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