from flask import Flask, render_template
from flask_login import LoginManager
from flask_session import Session
from flask_sqlalchemy import SQLAlchemy

from config import DevConfig

db = SQLAlchemy()
login_manager = LoginManager()
sess = Session()


def page_not_found(e):
    return render_template('404.html'), 404


def internal_server_error(e):
    return render_template('500.html'), 500


def create_app(config_class=DevConfig):
    """
    Creates an application instance to run
    :return: A Flask object
    """
    app = Flask(__name__)

    # Configure langbridge wth the settings from config.py
    app.config.from_object(config_class)

    # Initialise plugins
    db.init_app(app)
    login_manager.init_app(app)

    from populate_db import populate_db
    from langbridge.models import Teacher, User, BankAccount, Wallet, Language, Lesson, LessonReview
    with app.app_context():
        db.create_all()
        populate_db()

    # Register error handlers
    app.register_error_handler(404, page_not_found)
    app.register_error_handler(500, internal_server_error)

    # Register Blueprints
    from langbridge.main.routes import bp_main
    app.register_blueprint(bp_main)

    from langbridge.auth.routes import bp_auth
    app.register_blueprint(bp_auth)

    return app

47cb4ba4bcc200878d802a930cd0bfca26cde7d5
<mask token>


def page_not_found(e):
    return render_template('404.html'), 404


def internal_server_error(e):
    return render_template('500.html'), 500


<mask token>

<mask token>


def page_not_found(e):
    return render_template('404.html'), 404


def internal_server_error(e):
    return render_template('500.html'), 500


def create_app(config_class=DevConfig):
    """
    Creates an application instance to run
    :return: A Flask object
    """
    app = Flask(__name__)
    app.config.from_object(config_class)
    db.init_app(app)
    login_manager.init_app(app)
    from populate_db import populate_db
    from langbridge.models import Teacher, User, BankAccount, Wallet, Language, Lesson, LessonReview
    with app.app_context():
        db.create_all()
        populate_db()
    app.register_error_handler(404, page_not_found)
    app.register_error_handler(500, internal_server_error)
    from langbridge.main.routes import bp_main
    app.register_blueprint(bp_main)
    from langbridge.auth.routes import bp_auth
    app.register_blueprint(bp_auth)
    return app

<mask token>
db = SQLAlchemy()
login_manager = LoginManager()
sess = Session()


def page_not_found(e):
    return render_template('404.html'), 404


def internal_server_error(e):
    return render_template('500.html'), 500


def create_app(config_class=DevConfig):
    """
    Creates an application instance to run
    :return: A Flask object
    """
    app = Flask(__name__)
    app.config.from_object(config_class)
    db.init_app(app)
    login_manager.init_app(app)
    from populate_db import populate_db
    from langbridge.models import Teacher, User, BankAccount, Wallet, Language, Lesson, LessonReview
    with app.app_context():
        db.create_all()
        populate_db()
    app.register_error_handler(404, page_not_found)
    app.register_error_handler(500, internal_server_error)
    from langbridge.main.routes import bp_main
    app.register_blueprint(bp_main)
    from langbridge.auth.routes import bp_auth
    app.register_blueprint(bp_auth)
    return app

from flask import Flask, render_template
from flask_login import LoginManager
from flask_session import Session
from flask_sqlalchemy import SQLAlchemy
from config import DevConfig
db = SQLAlchemy()
login_manager = LoginManager()
sess = Session()


def page_not_found(e):
    return render_template('404.html'), 404


def internal_server_error(e):
    return render_template('500.html'), 500


def create_app(config_class=DevConfig):
    """
    Creates an application instance to run
    :return: A Flask object
    """
    app = Flask(__name__)
    app.config.from_object(config_class)
    db.init_app(app)
    login_manager.init_app(app)
    from populate_db import populate_db
    from langbridge.models import Teacher, User, BankAccount, Wallet, Language, Lesson, LessonReview
    with app.app_context():
        db.create_all()
        populate_db()
    app.register_error_handler(404, page_not_found)
    app.register_error_handler(500, internal_server_error)
    from langbridge.main.routes import bp_main
    app.register_blueprint(bp_main)
    from langbridge.auth.routes import bp_auth
    app.register_blueprint(bp_auth)
    return app

from flask import Flask, render_template
from flask_login import LoginManager
from flask_session import Session
from flask_sqlalchemy import SQLAlchemy

from config import DevConfig

db = SQLAlchemy()
login_manager = LoginManager()
sess = Session()


def page_not_found(e):
    return render_template('404.html'), 404


def internal_server_error(e):
    return render_template('500.html'), 500


def create_app(config_class=DevConfig):
    """
    Creates an application instance to run
    :return: A Flask object
    """
    app = Flask(__name__)

    # Configure langbridge wth the settings from config.py
    app.config.from_object(config_class)

    # Initialise plugins
    db.init_app(app)
    login_manager.init_app(app)

    from populate_db import populate_db
    from langbridge.models import Teacher, User, BankAccount, Wallet, Language, Lesson, LessonReview
    with app.app_context():
        db.create_all()
        populate_db()

    # Register error handlers
    app.register_error_handler(404, page_not_found)
    app.register_error_handler(500, internal_server_error)

    # Register Blueprints
    from langbridge.main.routes import bp_main
    app.register_blueprint(bp_main)

    from langbridge.auth.routes import bp_auth
    app.register_blueprint(bp_auth)

    return app
