import os import sys from flask import current_app from flask.ext.script import Manager,prompt,prompt_pass,\ prompt_bool,prompt_choices from flask.ext.script import Server from werkzeug import generate_password_hash,check_password_hash from motiky import configs from motiky.configs import db from motiky import create_app from motiky.logic.models import CmsUser app = create_app(configs.ProductionConfig) manager = Manager(app) @manager.command def create_all(): if prompt_bool("Are you sure? You will init your database"): db.create_all() @manager.command def drop_all(): if prompt_bool("Are you sure? You will lose all your data!"): db.drop_all() @manager.option('-u','--username',dest='username',required=True) @manager.option('-p','--password',dest='password',required=True) @manager.option('-e','--email',dest='email',required=True) def createuser(username=None,password=None,email=None):
def create_app(self): app = create_app(configs.TestConfig) app.config['TESTING'] = True return app
#/usr/bin/evn python # -*- coding: utf-8 -*- import os import sys import json import traceback sys.path.insert(0, '../') from komandr import * from motiky.logic.models import User, Post, Comment, Activity from motiky import create_app from motiky import configs from motiky.configs import db app = create_app(configs.ProductionConfig) @command('generate_notify_data') def generate_notify_data(): pass main()