예제 #1
0
def create_app():

    # Create a flask app.
    app = Flask(__name__)

    # Set debug true for catching the errors.
    app.config['DEBUG'] = True

    # Set database url.
    app.config['SQLALCHEMY_DATABASE_URI'] = SQLALCHEMY_DATABASE_URI

    app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = True

    # Database initialize with app.
    db.init_app(app)

    # Check if there is no database.
    if not os.path.exists(SQLALCHEMY_DATABASE_URI):

        # New db app if no database.
        db.app = app

        # Create all database tables.
        db.create_all()

    # Return app.
    return app
예제 #2
0
def create_app():

    # Create a flask app.
    app = Flask(__name__)

    # Set debug true for catching the errors.
    app.config['DEBUG'] = True

    # Set database url.
    app.config['SQLALCHEMY_DATABASE_URI'] = SQLALCHEMY_DATABASE_URI

    app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = True

    # Database initialize with app.
    db.init_app(app)

    # Check if there is no database.
    if not os.path.exists(SQLALCHEMY_DATABASE_URI):

        # New db app if no database.
        db.app = app

        # Create all database tables.
        db.create_all()

    # Return app.
    return app
예제 #3
0
def create_app():
    app = Flask(__name__)
    app.config['DEBUG'] = True
    app.config['SQLALCHEMY_DATABASE_URI'] = SQLALCHEMY_DATABASE_URI
    db.init_app(app)

    if not os.path.exists(SQLALCHEMY_DATABASE_URI):
        db.app = app
        db.create_all()

    return app
예제 #4
0
파일: main.py 프로젝트: yzhfury/ReserveMe
def create_app():

    app = Flask(__name__)

    CORS(app, resources={r"/*": {"origins": "*"}})

    app.config['DEBUG'] = False

    app.config['SQLALCHEMY_DATABASE_URI'] = SQLALCHEMY_DATABASE_URI

    app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False

    db.init_app(app)

    if not os.path.exists(SQLALCHEMY_DATABASE_URI):
        db.app = app
        db.create_all()
    return app
예제 #5
0
def create_app():

    # Create a flask app.
    app = Flask(__name__)

    # Set debug true for catching the errors.
    app.config['DEBUG'] = True

    # Set database url.
    app.config['SQLALCHEMY_DATABASE_URI'] = SQLALCHEMY_DATABASE_URI

    app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = True

    # Generate routes.
    generate_routes(app)

    # Database initialize with app.
    db.init_app(app)

    # Check if there is no database.
    if not os.path.exists(SQLALCHEMY_DATABASE_URI):

        # New db app if no database.
        db.app = app

        # Create all database tables.
        db.create_all()

        # Create default super admin user in database.
        create_super_admin()

        # Create default admin user in database.
        create_admin_user()

        # Create default test user in database.
        create_test_user()

    # Return app.
    return app
예제 #6
0
def create_app():
    app = Flask(__name__)

    app.config['SQLALCHEMY_DATABASE_URI'] = SQLALCHEMY_DATABASE_URI
    app.config['SQL_ALCHEMY_TRACK_MODIFICATIONS'] = True
    app.config['SECRET_KEY'] = SECRET_KEY
    app.config['JWT_SECRET_KEY'] = JWT_SECRET_KEY
    app.config['JWT_BLACKLIST_TOKEN_CHECKS'] = JWT_BLACKLIST_TOKEN_CHECKS
    app.config['JWT_BLACKLIST_TOKEN_ENABLED'] = True

    db.init_app(app)
    jwt = JWTManager(app)

    # @jwt.token_in_blacklist_loader
    # def check_if_token_in_blacklist(decrypted_token):
    #     jti = decrypted_token['jti']

    #     return

    if not os.path.exists(SQLALCHEMY_DATABASE_URI):
        db.app = app
        db.create_all()

    return app
예제 #7
0
        db.app = app

        # Create all database tables.
        db.create_all()

    # Return app.
    return app


if __name__ == '__main__':

    # Create app.
    app = create_app()

    # Create database tables.
    db.create_all()

    # Create default super admin user in database.
    create_super_admin()

    # Create default admin user in database.
    create_admin_user()

    # Create default test user in database.
    create_test_user()

    # Generate routes.
    generate_routes(app)

    # Run app.
    app.run(port=5000, debug=True, host='0.0.0.0', use_reloader=True)
예제 #8
0
        db.app = app

        # Create all database tables.
        db.create_all()

    # Return app.
    return app


if __name__ == '__main__':

    # Create app.
    app = create_app()

    # Create database tables.
    db.create_all()

    # Create default super admin user in database.
    create_super_admin()

    # Create default admin user in database.
    create_admin_user()

    # Create default test user in database.
    create_test_user()

    # Generate routes.
    generate_routes(app)

    # Run app.
    app.run(port=5000, debug=True, host='localhost', use_reloader=True)
예제 #9
0
    def setUp(self):

        db.create_all()