Ejemplo n.º 1
0
def make_shell_context():
    return dict(app=app, db=db)

@manager.command
def test():
    """Run the unit test."""
    import unittest
    tests = unittest.TestLoader().discover('tests')
    unittest.TextTestRunner(verbosity=2).run(tests)


@manager.command
def run_sql():
    sql = "SELECT cp.category_id,c.parent_id FROM fp_category_path AS cp"
    sql += " LEFT JOIN fp_category AS c ON (cp.category_id=c.id)"
    sql += " GROUP BY cp.category_id"
    result = db.engine.execute(sql)

    for row in result:
        print(row)



manager.add_command('shell', Shell(make_context=make_shell_context))
manager.add_command('db', MigrateCommand)
manager.add_command('apidoc', GenerateApiDoc(input_path='app/api_1_0',
                                             output_path='public/docs'))

if __name__ == '__main__':
    manager.run()
Ejemplo n.º 2
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from flask_script import Manager
from flask_migrate import Migrate, MigrateCommand
from flask_apidoc.commands import GenerateApiDoc
from app import app
from utils.exts import db
# from models import  User,Todo
# db.create_all()

manager = Manager(app)

# init  migrate upgrade
# 模型 -> 迁移文件 -> 表

# 1.要使用flask_migrate,必须绑定app和DB
migrate = Migrate(app, db)

# 2.把migrateCommand命令添加到manager中。
manager.add_command('db', MigrateCommand)
manager.add_command('apidoc', GenerateApiDoc())

if __name__ == '__main__':
    manager.run()
Ejemplo n.º 3
0
    OrderBr,
    BrDynamic,
    DynamicStock,
    DynamicInoutMaster,
    DynamicInoutDetail,
    User,
    BranchWareHouse
)

env = "microservice.config.{}Config".format("Dev")
app = create_app(env)


manager = Manager(app)
manager.add_command("server", Server)
manager.add_command("apidoc", GenerateApiDoc())


@manager.shell
def make_shell_context():
    return dict(app=app,
                db=db,
                OrderMaster=OrderMaster,
                OrderDetail=OrderDetail,
                OrderBr=OrderBr,
                Supply=Supply,
                BrDynamic=BrDynamic,
                DynamicStock=DynamicStock,
                DynamicInoutMaster=DynamicInoutMaster,
                DynamicInoutDetail=DynamicInoutDetail,
                Branch=Branch,
import app.config as config
from flask_apidoc.commands import GenerateApiDoc
from flask_script import Manager

manager = Manager(config.app)
manager.add_command(
    'apidoc',
    GenerateApiDoc(input_path='app/api', output_path='app/static/docs'))

if __name__ == "__main__":
    manager.run()
Ejemplo n.º 5
0
from app.api import api as app
from flask.ext.script import Manager
from flask_apidoc.commands import GenerateApiDoc

manager = Manager(app)
manager.add_command(
    'apidoc',
    GenerateApiDoc(input_path=None,
                   output_path='/home/vision/www/app/static/docs',
                   template_path=None))

if __name__ == '__main__':
    manager.run()
Ejemplo n.º 6
0
# from threading import Timer

import mongoengine
from flask_script import Manager
from flask_apidoc import ApiDoc
from flask_apidoc.commands import GenerateApiDoc
# from apscheduler.schedulers.background import BackgroundScheduler

from {{cookiecutter.project_slug}} import app, settings
from {{cookiecutter.project_slug}}.api import v1  # noqa: F401

mongoengine.connect(settings.DB_NAME,
                    host=settings.DB_HOST,
                    port=settings.DB_PORT)

ApiDoc(app=app,
       url_path='/api/docs',
       folder_path='.',
       dynamic_url=False)

manager = Manager(app)
manager.add_command('apidoc',
                    GenerateApiDoc(output_path='./{{cookiecutter.project_slug}}/static'))

if __name__ == '__main__':
    manager.run()
Ejemplo n.º 7
0
from iqvia.application import create_app
from flask_script import Manager
from flask_apidoc.commands import GenerateApiDoc
from flask_script import Server


manager = Manager(create_app('testing'), False)
manager.add_command('runserver', Server('0.0.0.0', 7000))
manager.add_command('apidoc', GenerateApiDoc('iqvia/', 'iqvia/static/docs/'))


if __name__ == "__main__":
    manager.run()

Ejemplo n.º 8
0
from website import application
from flask_apidoc.commands import GenerateApiDoc
from flask_script import Manager

manager = Manager(application)
manager.add_command('apidoc', GenerateApiDoc(output_path='docs'))

if __name__ == "__main__":
    manager.run()