File size: 610 Bytes
e6ecc60
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from flask import Flask
from config import Config
from .models import db

def create_app(config_class=Config):
    app = Flask(__name__)
    app.config.from_object(config_class)

    db.init_app(app)

    with app.app_context():
        from . import routes  # Import routes
        # db.drop_all() # Uncomment if you need to reset the DB
        db.create_all() # Create sql tables for our data models
        routes.register_routes(app) # Register the routes

    # Register blueprints here if you plan to use them
    # from .main import bp as main_bp
    # app.register_blueprint(main_bp)

    return app