def create_app(self): app = create_app(self) self.assertEqual(app.config['SQLALCHEMY_DATABASE_URI'], _DATABASE_URI) redis_series._redis.flushall() return app
# -- coding: utf-8 -- from home import create_app, db from flask_script import Manager from flask_migrate import Migrate, MigrateCommand # 创建flask的应用对象 app = create_app("develope") manager = Manager(app) Migrate(app, db) manager.add_command("db", MigrateCommand) if __name__ == "__main__": manager.run()
""" 外卖项目入口 """ from home import create_app, db from flask_script import Manager from flask_migrate import Migrate, MigrateCommand #创建app app = create_app('develop') migrate = Migrate(app, db) manager = Manager(app) manager.add_command('db', MigrateCommand) if __name__ == "__main__": #app.run() manager.run() #python manage.py runserver #python manage.py db init #python manage.py db migrate -m 'init table' #python manage.py db upgrade
defining the custom sub commands for the ``home`` command line interface. """ from datetime import datetime, timedelta from logging.config import dictConfig from sys import stdout from warnings import warn from flask.ext.migrate import MigrateCommand from flask.ext.script import Manager, Server, prompt_pass from home import create_app, db from home.collect.loop import collect as rfxcom_collect from home.dash.models import User app = create_app() manager = Manager(app, with_default_commands=False) manager.add_command('db', MigrateCommand) manager.add_command("dashboard", Server(host='0.0.0.0', use_debugger=False, use_reloader=False)) @manager.option('--device', help='Serial device.') def rfxcom(device): """Start the event loop to collect data from the serial device.""" # If the device isn't passed in, look for it in the config. if device is None: device = app.config.get('DEVICE')
""" from datetime import datetime, timedelta from logging.config import dictConfig from sys import stdout from warnings import warn from flask.ext.migrate import MigrateCommand from flask.ext.script import Manager, Server, prompt_pass from home import create_app, db from home.collect.loop import collect as rfxcom_collect from home.dash.models import User from home.webcam.loop import collect as webcam_collect app = create_app() manager = Manager(app, with_default_commands=False) manager.add_command('db', MigrateCommand) manager.add_command("dashboard", Server(host='0.0.0.0', use_debugger=False, use_reloader=False)) @manager.option('--device', help='Serial device.') def rfxcom(device): """Start the event loop to collect data from the serial device.""" # If the device isn't passed in, look for it in the config. if device is None: device = app.config.get('DEVICE')