예제 #1
0
def init_app(app):
    db.init_app(app)
    csrf.init_app(app)
    cors.init_app(app)
    cache.init_app(app)
    mail.init_app(app)
    redis.init_app(app)
    maple.init_app(app)
    login.init_app(app)
    babel.init_app(app)
예제 #2
0
def init_app(app):
    db.init_app(app)
    csrf.init_app(app)
    cache.init_app(app)
    babel.init_app(app)
    mail.init_app(app)
    login_manager.init_app(app)
    redis_data.init_app(app)
    middleware.init_app(app)
    maple_app.init_app(app)
    register_maple(app)
예제 #3
0
def init_app(app):
    db.init_app(app)
    avatar.init_app(app)
    cache.init_app(app)
    csrf.init_app(app)
    principal.init_app(app)
    redis_data.init_app(app)
    mail.init_app(app)
    search.init_app(app)

    babel.init_app(app)
    login.init_app(app)
    maple.init_app(app)
예제 #4
0
def init_app(app):
    db.init_app(app)
    cache.init_app(app)
    avatar.init_app(app)
    csrf.init_app(app)
    principal.init_app(app)
    redis_data.init_app(app)
    mail.init_app(app)
    search.init_app(app)

    babel.init_app(app)
    login.init_app(app)
    maple.init_app(app)
예제 #5
0
def init_app(app):
    db.init_app(app)
    login_manager.init_app(app)
    Middleware(app)
예제 #6
0
    SECRET_KEY_SALT = 'asdasdads'
    TEMPLATES_AUTO_RELOAD = True

    SQLALCHEMY_TRACK_MODIFICATIONS = False
    # SQLALCHEMY_DATABASE_URI = 'postgresql://*****:*****@localhost/blog'
    SQLALCHEMY_DATABASE_URI = 'sqlite:///test.db'

    BABEL_TRANSLATION_DIRECTORIES = os.path.abspath(
        os.path.join(
            os.path.dirname(__file__), os.pardir, 'flask_maple',
            'translations'))


app = Flask(__name__)
app.config.from_object(config)
db.init_app(app)

admin = Admin(name='devops', template_mode='bootstrap3')
for model in [User, Group]:
    admin.add_view(ModelView(model, db.session, category='user'))
admin.init_app(app)

cli = FlaskGroup(add_default_commands=False, create_app=lambda r: app)
cli.add_command(run_command)


@cli.command('shell', short_help='Starts an interactive shell.')
def shell_command():
    ctx = current_app.make_shell_context()
    interact(local=ctx)