if filename: file_path = os.path.join(app.root_path, endpoint, filename) values['q'] = int(os.stat(file_path).st_mtime) return url_for(endpoint, **values) def init(): from packages.auth.views import auth from packages.auth.commands import AddUser app.register_blueprint(auth) manager.add_command('add_user', AddUser) from packages.books.views import books from packages.books.commands import UploadBooks app.register_blueprint(books) manager.add_command('upload_books', UploadBooks) db.init_app(app) lm.init_app(app) init() with app.app_context(): db.engine.dialect.supports_sane_rowcount = False db.engine.dialect.supports_sane_multi_rowcount = False if __name__ == '__main__': manager.run()
def __call__(self, *args, **kwargs): with app.app_context(): return TaskBase.__call__(self, *args, **kwargs)